Skip to content

Commit

Permalink
text: some x509 identfiers require NULL even though its optional
Browse files Browse the repository at this point in the history
https://www.ietf.org/rfc/rfc4055.txt

"In this case, the rsaEncryption object identifier MUST be used in the
algorithm field within the subject public key information, and the
parameters field MUST contain NULL."
  • Loading branch information
pinheadmz committed Jan 28, 2022
1 parent c20d814 commit dd15c2c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/x509-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ describe('X509', function() {
version: 2,
serialNumber: 'deadbeef0101',
signature: {
algorithm: 'RSASHA256'
algorithm: 'RSASHA256',
parameters: {
type: 'NULL',
node: null
}
},
issuer: [],
validity: {
Expand All @@ -97,7 +101,11 @@ describe('X509', function() {
subject: [],
subjectPublicKeyInfo: {
algorithm: {
algorithm: 'RSAPublicKey'
algorithm: 'RSAPublicKey',
parameters: {
type: 'NULL',
node: null
}
},
publicKey: {
modulus: pubJSON.n,
Expand Down Expand Up @@ -163,7 +171,12 @@ describe('X509', function() {
// Complete
certFromJSON = new x509.Certificate();
certFromJSON.tbsCertificate = tbs;
certFromJSON.signatureAlgorithm.fromJSON({algorithm: 'RSASHA256'});
certFromJSON.signatureAlgorithm.fromJSON({
algorithm: 'RSASHA256',
parameters: {
type: 'NULL',
node: null
}});
certFromJSON.signature.fromJSON({bits: sig.length * 8, value: sig.toString('hex')});
});

Expand Down

0 comments on commit dd15c2c

Please sign in to comment.