diff options
Diffstat (limited to 'src/libraries/System.Security.Cryptography/tests/AesTests.Browser.cs')
-rw-r--r-- | src/libraries/System.Security.Cryptography/tests/AesTests.Browser.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libraries/System.Security.Cryptography/tests/AesTests.Browser.cs b/src/libraries/System.Security.Cryptography/tests/AesTests.Browser.cs index 32c253a1234..5e8eafbaa38 100644 --- a/src/libraries/System.Security.Cryptography/tests/AesTests.Browser.cs +++ b/src/libraries/System.Security.Cryptography/tests/AesTests.Browser.cs @@ -43,5 +43,20 @@ namespace System.Security.Cryptography.Tests Assert.Throws<PlatformNotSupportedException>(() => aes.CreateDecryptor(s_iv, s_iv)); } } + + // Browser's SubtleCrypto doesn't support AES-192 + [Fact] + public static void Aes_InvalidKeySize_192_Browser() + { + byte[] key192 = new byte[192 / 8]; + using (Aes aes = Aes.Create()) + { + Assert.False(aes.ValidKeySize(192)); + Assert.Throws<CryptographicException>(() => aes.Key = key192); + Assert.Throws<CryptographicException>(() => aes.KeySize = 192); + Assert.Throws<ArgumentException>(() => aes.CreateEncryptor(key192, s_iv)); + Assert.Throws<ArgumentException>(() => aes.CreateDecryptor(key192, s_iv)); + } + } } } |