mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Created test to ensure decryption failures throw an exception in AeadCryptographyProvider
This commit is contained in:
@@ -4,6 +4,8 @@ using System.Security;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Constraints;
|
||||
using Org.BouncyCastle.Security;
|
||||
|
||||
|
||||
namespace mRemoteNGTests.Security
|
||||
@@ -72,5 +74,13 @@ namespace mRemoteNGTests.Security
|
||||
}
|
||||
return combinationList;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DecryptionFailureThrowsException()
|
||||
{
|
||||
var cipherText = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
ActualValueDelegate<string> decryptMethod = () => _cryptographyProvider.Decrypt(cipherText, "wrongKey".ConvertToSecureString());
|
||||
Assert.That(decryptMethod, Throws.TypeOf<EncryptionException>());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user