File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -616,6 +616,52 @@ var UTIL = require('../../lib/util');
616616 ASSERT . equal ( attribute . value , 'Test Avenue' ) ;
617617 } ) ;
618618
619+ it ( 'should generate a certificate with pseudonym attribute' , function ( ) {
620+ var keys = {
621+ privateKey : PKI . privateKeyFromPem ( _pem . privateKey ) ,
622+ publicKey : PKI . publicKeyFromPem ( _pem . publicKey )
623+ } ;
624+ var attrs = [ {
625+ name : 'commonName' ,
626+ value : 'example.org'
627+ } , {
628+ name : 'countryName' ,
629+ value : 'US'
630+ } , {
631+ shortName : 'ST' ,
632+ value : 'Virginia'
633+ } , {
634+ name : 'localityName' ,
635+ value : 'Blacksburg'
636+ } , {
637+ name : 'organizationName' ,
638+ value : 'Test'
639+ } , {
640+ shortName : 'OU' ,
641+ value : 'Test'
642+ } , {
643+ name : 'pseudonym' ,
644+ value : 'Satoshi Nakamato'
645+ } ] ;
646+ var cert = createCertificate ( {
647+ publicKey : keys . publicKey ,
648+ signingKey : keys . privateKey ,
649+ serialNumber : '01' ,
650+ subject : attrs ,
651+ issuer : attrs ,
652+ isCA : true
653+ } ) ;
654+
655+ var pem = PKI . certificateToPem ( cert ) ;
656+ cert = PKI . certificateFromPem ( pem ) ;
657+ var index = findIndex ( cert . subject . attributes , { type : '2.5.4.65' } ) ;
658+ ASSERT . ok ( index !== - 1 ) ;
659+ var attribute = cert . subject . attributes [ index ] ;
660+ ASSERT . equal ( attribute . name , 'pseudonym' ) ;
661+ ASSERT . equal ( attribute . value , 'Satoshi Nakamato' ) ;
662+ } ) ;
663+
664+
619665 it ( 'should generate a certificate with jurisdictionOfIncorporationStateOrProvinceName attribute' , function ( ) {
620666 var keys = {
621667 privateKey : PKI . privateKeyFromPem ( _pem . privateKey ) ,
You can’t perform that action at this time.
0 commit comments