public Recipient(string userId, IDigestEncryptor digestEncryptor) { UserId = userId; DigestEncryptor = digestEncryptor; }
/// <summary> /// Encrypt the AES key using the IEncryptor interface. This method creates the /// DigestData /// </summary> /// <param name="digestEncryptor">IDigestEncryptor object</param> /// <returns>The DigestData after the key and IV have been encrypted</returns> public DigestData EncryptKey(IDigestEncryptor digestEncryptor) { // Get the AES key and IV to encrypt them byte[] aesKeyAndIV = new byte[aesProvider.Key.Length + aesProvider.IV.Length]; Buffer.BlockCopy(aesProvider.Key, 0, aesKeyAndIV, 0, aesProvider.Key.Length); Buffer.BlockCopy(aesProvider.IV, 0, aesKeyAndIV, aesProvider.Key.Length, aesProvider.IV.Length); digestEncryptor.Encrypt(aesKeyAndIV); return digestEncryptor.Digest; }