private static byte[] DecipherContent(string wrappedReceiptKey, string content, AsymmetricCipherKeyPair keyPair) { byte[] unwrappedKey = UnwrapKey(wrappedReceiptKey, keyPair); byte[] contentBytes = Conversion.Base64ToBytes(content); EncryptedData encryptedData = EncryptedData.Parser.ParseFrom(contentBytes); byte[] iv = encryptedData.Iv.ToByteArray(); byte[] cipherText = encryptedData.CipherText.ToByteArray(); byte[] decipheredBytes = DecipherAes(unwrappedKey, iv, cipherText); return(decipheredBytes); }
public static AttributeList DecryptCurrentUserReceipt(string wrappedReceiptKey, string otherPartyProfile, AsymmetricCipherKeyPair keyPair) { byte[] unwrappedKey = UnwrapKey(wrappedReceiptKey, keyPair); byte[] otherPartyProfileContentBytes = Conversion.Base64ToBytes(otherPartyProfile); EncryptedData encryptedData = EncryptedData.Parser.ParseFrom(otherPartyProfileContentBytes); byte[] iv = encryptedData.Iv.ToByteArray(); byte[] cipherText = encryptedData.CipherText.ToByteArray(); byte[] decipheredBytes = DecipherAes(unwrappedKey, iv, cipherText); return(AttributeList.Parser.ParseFrom(decipheredBytes)); }
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)); }
public YotiAttributeValue(TypeEnum type, string data) { _type = type; switch (_type) { case TypeEnum.Jpeg: case TypeEnum.Png: _data = Conversion.Base64ToBytes(data); break; default: _data = Conversion.UtfToBytes(data); break; } }
internal static byte[] UnwrapKey(string wrappedKey, AsymmetricCipherKeyPair keyPair) { byte[] cipherBytes = Conversion.Base64ToBytes(wrappedKey); return(DecryptRsa(cipherBytes, keyPair)); }
private byte[] UnwrapKey(string wrappedKey, AsymmetricCipherKeyPair keyPair) { byte[] cipherBytes = Conversion.Base64ToBytes(wrappedKey); return(CryptoEngine.DecryptRsa(cipherBytes, keyPair)); }