Skip to content

Commit

Permalink
Fix certificate signature algorithm not valid (#904)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarco76 committed Apr 16, 2024
1 parent 629ea45 commit 8df7456
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/test/java/org/mozilla/jss/tests/GenerateTestCert.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,13 @@ private Certificate makeCert(String issuerName,
int rand,
SEQUENCE extensions) throws Exception {

AlgorithmIdentifier sigAlgID = new AlgorithmIdentifier(sigAlg.toOID());

AlgorithmIdentifier sigAlgID = null;
if(keyType.equals("RSA")) {
sigAlgID = new AlgorithmIdentifier(sigAlg.toOID(), null);
}
else {
sigAlgID = new AlgorithmIdentifier(sigAlg.toOID());
}
Name issuer = new Name();
issuer.addCountryName("US");
issuer.addOrganizationName("Mozilla");
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/mozilla/jss/tests/SSLClientAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public class SSLClientAuth implements Runnable {
public static Certificate makeCert(String issuerName, String subjectName,
int serialNumber, PrivateKey privKey, PublicKey pubKey, int rand,
SEQUENCE extensions) throws Exception {
AlgorithmIdentifier sigAlgID = new AlgorithmIdentifier( sigAlg.toOID());
AlgorithmIdentifier sigAlgID = new AlgorithmIdentifier( sigAlg.toOID(), null);

Name issuer = new Name();
issuer.addCountryName("US");
issuer.addOrganizationName("Mozilla");
Expand Down

0 comments on commit 8df7456

Please sign in to comment.