/* Checks Attestation report by calling the CMC to Verify and checking its status response
 */
Checks Attestation report by calling the CMC to Verify and checking its status response
/ * Checks Attestation report by calling the CMC to Verify and checking its status response * /
func verifyAR(nonce, report []byte) (error) {
	var req ci.VerificationRequest
	var resp *ci.VerificationResponse
	var result ar.VerificationResult
	var err error
	cmcClient, conn, cancel := getCMCServiceConn();
	if cmcClient == nil {
		return errors.New("[Dialer] Connection failed. No result obtained.")
	}
	defer conn.Close()
	defer cancel()
	log.Trace("[Dialer] Contacting backend for AR verification.")
	req = ci.VerificationRequest{
		Nonce : nonce,
		AttestationReport : report,
	}
	resp, err = cmcClient.Verify(context.Background(), &req)
	if err != nil {
		log.Error(err)
		return errors.New("[Dialer] Could not obtain verification result")
	}
	if resp.GetStatus() != ci.Status_OK {
		return errors.New("[Dialer] Obtaining verification result failed")
	}
	err = json.Unmarshal(resp.GetVerificationResult(), &result)
	if err != nil {
		log.Error(err)
		return errors.New("[Dialer] Could not parse verification result")
	}
	if !result.Success {
		log.Error(result.Log)
		return errors.New("[Dialer] Verification failed.")
	}
	return nil
}
func verifyAR ( nonce , report [ ] byte ) ( error ) { var req ci . VerificationRequest var resp * ci . VerificationResponse var result ar . VerificationResult var err error cmcClient , conn , cancel := getCMCServiceConn ( ) ; if cmcClient == nil { return errors . New ( " " ) } defer conn . Close ( ) defer cancel ( ) log . Trace ( " " ) req = ci . VerificationRequest { Nonce : nonce , AttestationReport : report , } resp , err = cmcClient . Verify ( context . Background ( ) , & req ) if err != nil { log . Error ( err ) return errors . New ( " " ) } if resp . GetStatus ( ) != ci . Status_OK { return errors . New ( " " ) } err = json . Unmarshal ( resp . GetVerificationResult ( ) , & result ) if err != nil { log . Error ( err ) return errors . New ( " " ) } if ! result . Success { log . Error ( result . Log ) return errors . New ( " " ) } return nil }
Checks Attestation report by calling the CMC to Verify and checking its status response
Checks Attestation report by calling the CMC to Verify and checking its status response
// Get backend connection // Create Verification request // Perform Verify request // Check Verify response // parse VerificationResult // check results