Skip to content

Commit

Permalink
Update some CertificateRequest tests to behave correctly on systems l…
Browse files Browse the repository at this point in the history
…acking SHA-1
  • Loading branch information
tmds authored Feb 2, 2023
1 parent b563df9 commit 9408859
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,15 @@ public static void VerifySignature_RSA_PKCS1(string hashAlgorithm)

if (hashAlgorithm == "SHA1")
{
pkcs10 = first.CreateSigningRequest(new RSASha1Pkcs1SignatureGenerator(key));
if (SignatureSupport.SupportsX509Sha1Signatures)
{
pkcs10 = first.CreateSigningRequest(new RSASha1Pkcs1SignatureGenerator(key));
}
else
{
Assert.ThrowsAny<CryptographicException>(() => first.CreateSigningRequest(new RSASha1Pkcs1SignatureGenerator(key)));
return;
}
}
else
{
Expand Down Expand Up @@ -386,7 +394,15 @@ public static void VerifySignature_RSA_PSS(string hashAlgorithm)

if (hashAlgorithm == "SHA1")
{
pkcs10 = first.CreateSigningRequest(new RSASha1PssSignatureGenerator(key));
if (SignatureSupport.SupportsX509Sha1Signatures)
{
pkcs10 = first.CreateSigningRequest(new RSASha1PssSignatureGenerator(key));
}
else
{
Assert.ThrowsAny<CryptographicException>(() => first.CreateSigningRequest(new RSASha1PssSignatureGenerator(key)));
return;
}
}
else
{
Expand Down

0 comments on commit 9408859

Please sign in to comment.