-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#38 want support for more obscure DN OIDs
Reviewed by: Cody Peter Mello <[email protected]> Approved by: Cody Peter Mello <[email protected]>
- Loading branch information
Showing
7 changed files
with
240 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDhzCCAm+gAwIBAgIHWAIFM3wFkDANBgkqhkiG9w0BAQsFADCBrTERMA8GA1UE | ||
DAwIY2VydC5rZXkxLTArBgNVBAMMJDJkYzc5ZDM2LWVhMDEtYzg1NS1lYWI1LWUy | ||
YzdhMjRhYmJmNDEOMAwGA1UEKgwFem9uZTExNDAyBgoJkiaJk/IsZAEBDCRmZTAz | ||
ZmY0MC1kYjEyLTExZTctYjQ4Yi02M2QxNTNhZjY5ODUxEjAQBgNVBAsMCWluc3Rh | ||
bmNlczEPMA0GA1UECgwGdHJpdG9uMB4XDTE3MTIxNTIzMDUyMFoXDTE3MTIxNTIz | ||
MDYyMFowgbYxFDASBgNVBAwMC2luLXpvbmUua2V5MS0wKwYDVQQDDCQyZGM3OWQz | ||
Ni1lYTAxLWM4NTUtZWFiNS1lMmM3YTI0YWJiZjQxNDAyBgoJkiaJk/IsZAEBDCRm | ||
ZTAzZmY0MC1kYjEyLTExZTctYjQ4Yi02M2QxNTNhZjY5ODUxEjAQBgNVBAsMCWRl | ||
bGVnYXRlZDEPMA0GA1UECgwGdHJpdG9uMRQwEgYDVQQMDAtpbi16b25lLmtleTBZ | ||
MBMGByqGSM49AgEGCCqGSM49AwEHA0IABMu/RgdeZ0/V9JqV3ByWW4t7/ncxcEnA | ||
nsq1CBPwPIfb0aUhVy+FrJTYV+m+gStGJW9ZwE8uuU61rmxKdO+WWVSjbDBqMA8G | ||
A1UdEwEB/wQFMAMBAQAwDgYDVR0PAQH/BAQDAgGIMBYGA1UdJQEB/wQMMAoGCCsG | ||
AQUFBwMBMC8GA1UdEQQoMCaCJDJkYzc5ZDM2LWVhMDEtYzg1NS1lYWI1LWUyYzdh | ||
MjRhYmJmNDANBgkqhkiG9w0BAQsFAAOCAQEAcRmBTD0bnI58nEjWXTTBPHYzBL8c | ||
V6QBzfYOCNE6iXl1zzH3oR/x3+yIMRhTrw1tHv4A0lunvKZsz9fogy/8uTTQtOaT | ||
xoXmjhvY7m1VZqb7W4+aG7DbJ2oZxIaZABXGEp+huKG5LPsmn0BGqJ2q8NxX3NKw | ||
PPjyTZdwjVaxwSomkzIaGqjdWmRKeqxbkwL19SN9Rk9ZoytG1pjTrzWQW4yaYa+s | ||
aycLMrrRMZE51qBPqFxf8YvXDHXk1gugQqJSRgmo4q/tFqloTwM+0D3tElzmAPCc | ||
jPLGIkJ5/y+pQ81vTRl0HJmzndlg0ucbpiTRyZt9cpOe17KjvB8+tgy58w== | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,6 +229,17 @@ test('napoleon cert (generalizedtime) (x509)', function (t) { | |
console.log(cert.validFrom.getTime()); | ||
console.log(cert.validUntil.getTime()); | ||
t.ok(!cert.isExpired(new Date('1775-03-01T00:00Z'))); | ||
t.deepEqual(cert.subjects[0].toArray(), [ | ||
{ name: 'c', value: 'FR' }, | ||
{ name: 's', value: 'Île-de-France' }, | ||
{ name: 'l', value: 'Paris' }, | ||
{ name: 'o', value: 'Hereditary Monarchy' }, | ||
{ name: 'ou', value: 'Head of State' }, | ||
{ name: 'emailAddress', value: '[email protected]' }, | ||
{ name: 'cn', value: 'Emperor Napoleon I' }, | ||
{ name: 'sn', value: 'Bonaparte' }, | ||
{ name: 'gn', value: 'Napoleon' } | ||
]); | ||
t.end(); | ||
}); | ||
|
||
|
@@ -250,6 +261,8 @@ test('example cert: digicert (x509)', function (t) { | |
t.strictEqual(cert.subjects[0].hostname, 'www.digicert.com'); | ||
t.strictEqual(cert.issuer.cn, | ||
'DigiCert SHA2 Extended Validation Server CA'); | ||
t.strictEqual(cert.issuer.get('c'), 'US'); | ||
t.strictEqual(cert.issuer.get('o'), 'DigiCert Inc'); | ||
|
||
var cacert = sshpk.parseCertificate( | ||
fs.readFileSync(path.join(testDir, 'digicert-ca.crt')), 'x509'); | ||
|
@@ -356,3 +369,20 @@ test('example cert: ed25519 cert from curdle-pkix-04', function (t) { | |
|
||
t.end(); | ||
}); | ||
|
||
test('cert with doubled-up DN attribute', function (t) { | ||
var cert = sshpk.parseCertificate( | ||
fs.readFileSync(path.join(testDir, 'double-title-cert.pem')), | ||
'pem'); | ||
|
||
var id = cert.subjects[0]; | ||
t.throws(function () { | ||
id.get('title'); | ||
}); | ||
t.deepEqual(id.get('title', true), ['in-zone.key', 'in-zone.key']); | ||
|
||
t.strictEqual(id.get('ou'), 'delegated'); | ||
t.strictEqual(id.get('cn'), '2dc79d36-ea01-c855-eab5-e2c7a24abbf4'); | ||
|
||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters