internal byte[] Decrypt(byte[] byteArrayToDecrypt, EncryptionDerivedKey encryptionDerivedKey, byte[] ivMod) { _aesManaged.Key = encryptionDerivedKey.CipherKey; _aesManaged.IV = TransformIV(encryptionDerivedKey.IV, ivMod); var aesDecryptor = _aesManaged.CreateDecryptor(); return(aesDecryptor.TransformFinalBlock(byteArrayToDecrypt, 0, byteArrayToDecrypt.Length)); }
internal byte[] Encrypt(byte[] byteArrayToEncrypt, EncryptionDerivedKey encryptionDerivedKey, byte[] ivMod) { _aesManaged.Key = encryptionDerivedKey.CipherKey; _aesManaged.IV = TransformIV(encryptionDerivedKey.IV, ivMod); var encryptTransform = _aesManaged.CreateEncryptor(); var byteArrayEncrypted = encryptTransform.TransformFinalBlock(byteArrayToEncrypt, 0, byteArrayToEncrypt.Length); return(byteArrayEncrypted); }