in java/remoteprovisioning/CertificateRequestSerializer.java [106:128]
private CBORObject buildMacedKeysToSign() throws CborException, CryptoException {
MAC0Message msg = new MAC0Message();
try {
msg.addAttribute(
HeaderKeys.Algorithm, AlgorithmID.HMAC_SHA_256.AsCBOR(), Attribute.PROTECTED);
} catch (CoseException e) {
throw new CborException(
"Malformed input - this should not happen", e, CborException.SERIALIZATION_ERROR);
}
msg.SetContent(mPublicKeys.EncodeToBytes());
try {
msg.Create(mMacKey.ToObject(byte[].class));
} catch (CoseException e) {
throw new CryptoException(
"Failed to MAC the MACed keys to sign", e, CryptoException.MACING_FAILURE);
}
try {
return msg.EncodeToCBORObject();
} catch (CoseException e) {
throw new CborException(
"Failed to serialize MACed keys to sign", e, CborException.SERIALIZATION_ERROR);
}
}