private CBORObject buildSignedMac()

in java/remoteprovisioning/CertificateRequestSerializer.java [149:171]


  private CBORObject buildSignedMac(byte[] macedKeysMac) throws CryptoException, CborException {
    Sign1Message msg = new Sign1Message();
    try {
      msg.addAttribute(HeaderKeys.Algorithm, mDkPriv.get(KeyKeys.Algorithm), Attribute.PROTECTED);
    } catch (CoseException e) {
      throw new CborException(
          "Malformed input - this should not happen", e, CborException.SERIALIZATION_ERROR);
    }
    msg.setExternal(buildSignedDataAad(macedKeysMac).EncodeToBytes());
    msg.SetContent(mMacKey.GetByteString());
    try {
      msg.sign(mDkPriv);
    } catch (CoseException e) {
      throw new CryptoException(
          "Failed to sign MAC key with device private key", e, CryptoException.SIGNING_FAILURE);
    }
    try {
      return msg.EncodeToCBORObject();
    } catch (CoseException e) {
      throw new CborException(
          "Failed to serialize signed MAC", e, CborException.SERIALIZATION_ERROR);
    }
  }