in java/remoteprovisioning/ProtectedDataPayload.java [164:184]
private OneKey verifyBccAndExtractDevicePublicKey(CBORObject bcc)
throws CborException, CryptoException {
CborUtil.checkArrayMinLength(bcc, BCC_LENGTH_MINIMUM, "BCC");
CborUtil.checkMap(bcc.get(BCC_DEVICE_PUBLIC_KEY_INDEX), "First entry in the BCC");
// verify the certificate chain
if (!CryptoUtil.validateBcc(bcc)) {
throw new CryptoException(
"Failed to verify certificate chain", CryptoException.VERIFICATION_FAILURE);
}
// Extract and return the public key
try {
return new OneKey(bcc.get(BCC_DEVICE_PUBLIC_KEY_INDEX));
} catch (CoseException e) {
throw new CborException(
"Failed to decode the certificate containing the device public key",
e,
CborException.DESERIALIZATION_ERROR);
}
}