Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 4603d5c

Browse files
committed
Modify algorithm not supported tests to expect CryptographicException
1 parent faab40d commit 4603d5c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/ContentEncryptionAlgorithmTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ public static void DecodeAlgorithmRc4_40_PlatformNotSupported()
146146
using (X509Certificate2 cert = Certificates.RSAKeyTransferCapi1.GetCertificate())
147147
{
148148
CmsRecipient recipient = new CmsRecipient(SubjectIdentifierType.IssuerAndSerialNumber, cert);
149-
Assert.Throws<PlatformNotSupportedException>(() => ecms.Encrypt(recipient));
149+
150+
CryptographicException e =
151+
Assert.Throws<CryptographicException>(() => ecms.Encrypt(recipient));
152+
153+
Assert.Contains(Oids.Rc4, e.Message);
150154
}
151155
}
152156

src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/KeyAgreeRecipientInfoTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ public static void TestKeyAgreement_PlatformNotSupported()
2424
using (X509Certificate2 cert = Certificates.DHKeyAgree1.GetCertificate())
2525
{
2626
CmsRecipient cmsRecipient = new CmsRecipient(cert);
27-
Assert.Throws<PlatformNotSupportedException>(() => ecms.Encrypt(cmsRecipient));
27+
28+
CryptographicException e =
29+
Assert.Throws<CryptographicException>(() => ecms.Encrypt(cmsRecipient));
30+
31+
Assert.Contains(cert.GetKeyAlgorithm(), e.Message);
2832
}
2933
}
3034

0 commit comments

Comments
 (0)