mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8299746: Accept unknown signatureAlgorithm in PKCS7 SignerInfo
Reviewed-by: kdriver, ascarpino, hchao
This commit is contained in:
parent
3dcf700161
commit
ba03f42a50
2 changed files with 62 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -537,7 +537,16 @@ public class SignerInfo implements DerEncoder {
|
|||
digAlg = "SHA" + digAlg.substring(4);
|
||||
}
|
||||
if (keyAlg.equals("EC")) keyAlg = "ECDSA";
|
||||
return digAlg + "with" + keyAlg;
|
||||
String sigAlg = digAlg + "with" + keyAlg;
|
||||
try {
|
||||
Signature.getInstance(sigAlg);
|
||||
return sigAlg;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// Possibly an unknown modern signature algorithm,
|
||||
// in this case, encAlg should already be a signature
|
||||
// algorithm.
|
||||
return encAlg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue