예제 #1
0
        private AttributeList DecryptCurrentUserReceipt(ReceiptDO receipt, AsymmetricCipherKeyPair keyPair)
        {
            byte[] unwrappedKey = UnwrapKey(receipt.wrapped_receipt_key, keyPair);

            byte[]        otherPartyProfileContentBytes = Conversion.Base64ToBytes(receipt.other_party_profile_content);
            EncryptedData encryptedData = EncryptedData.Parser.ParseFrom(otherPartyProfileContentBytes);

            byte[] iv         = encryptedData.Iv.ToByteArray();
            byte[] cipherText = encryptedData.CipherText.ToByteArray();

            byte[] decipheredBytes = CryptoEngine.DecipherAes(unwrappedKey, iv, cipherText);

            return(AttributeList.Parser.ParseFrom(decipheredBytes));
        }