Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OID for pseudonym #1043

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/oids.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ _IN('2.5.4.13', 'description');
_IN('2.5.4.15', 'businessCategory');
_IN('2.5.4.17', 'postalCode');
_IN('2.5.4.42', 'givenName');
_IN('2.5.4.65', 'pseudonym');
_IN('1.3.6.1.4.1.311.60.2.1.2', 'jurisdictionOfIncorporationStateOrProvinceName');
_IN('1.3.6.1.4.1.311.60.2.1.3', 'jurisdictionOfIncorporationCountryName');

Expand Down
46 changes: 46 additions & 0 deletions tests/unit/x509.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,52 @@ var UTIL = require('../../lib/util');
ASSERT.equal(attribute.value, 'Test Avenue');
});

it('should generate a certificate with pseudonym attribute', function() {
var keys = {
privateKey: PKI.privateKeyFromPem(_pem.privateKey),
publicKey: PKI.publicKeyFromPem(_pem.publicKey)
};
var attrs = [{
name: 'commonName',
value: 'example.org'
}, {
name: 'countryName',
value: 'US'
}, {
shortName: 'ST',
value: 'Virginia'
}, {
name: 'localityName',
value: 'Blacksburg'
}, {
name: 'organizationName',
value: 'Test'
}, {
shortName: 'OU',
value: 'Test'
}, {
name: 'pseudonym',
value: 'Satoshi Nakamato'
}];
var cert = createCertificate({
publicKey: keys.publicKey,
signingKey: keys.privateKey,
serialNumber: '01',
subject: attrs,
issuer: attrs,
isCA: true
});

var pem = PKI.certificateToPem(cert);
cert = PKI.certificateFromPem(pem);
var index = findIndex(cert.subject.attributes, {type: '2.5.4.65'});
ASSERT.ok(index !== -1);
var attribute = cert.subject.attributes[index];
ASSERT.equal(attribute.name, 'pseudonym');
ASSERT.equal(attribute.value, 'Satoshi Nakamato');
});


it('should generate a certificate with jurisdictionOfIncorporationStateOrProvinceName attribute', function() {
var keys = {
privateKey: PKI.privateKeyFromPem(_pem.privateKey),
Expand Down