diff --git a/lib/PayPro.js b/lib/PayPro.js index 931ffae..59042a2 100644 --- a/lib/PayPro.js +++ b/lib/PayPro.js @@ -274,6 +274,7 @@ PayPro.prototype.x509Verify = function() { var rfc5280 = {}; +var AuthorityKeyIdentifier = rfc5280.AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function() { this.seq().obj( this.key('keyIdentifier').optional().octstr(), @@ -282,6 +283,110 @@ rfc5280.AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function( ); }); +var GeneralNames = +rfc5280.GeneralNames = asn1.define('GeneralNames', function() { + this.seq().obj( + this.key('generalNames').use(rfc5280.GeneralName) + ); +}); + +var GeneralName = +rfc5280.GeneralName = asn1.define('GeneralName', function() { + this.choice({ + otherName: this.use(OtherName), + rfc822Name: this.use(IA5String), + dNSName: this.use(IA5String), + x400Address: this.use(ORAddress), + directoryName: this.use(rfc3280.Name), + ediPartyName: this.use(EDIPartyName), + uniformResourceIdentifier: this.use(IA5String), + iPAddress: this.octstr(), + registeredID: this.objid() + }); +}); + +var OtherName = +rfc5280.OtherName = asn1.define('OtherName', function() { + this.seq().obj( + this.key('typeId').objid(), + this.key('value') + ); +}); + +// https://www.google.com/search?q=IA5String +// https://en.wikipedia.org/wiki/IA5STRING +// http://msdn.microsoft.com/en-us/library/windows/desktop/bb540805(v=vs.85).aspx +var IA5String = +rfc5280.IA5String = asn1.define('IA5String', function() { + this.octstr(); // unsure +}); + +var ORAddress = +rfc5280.ORAddress = asn1.define('ORAddress', function() { + this.seq().obj( + this.key('builtInStandardAttributes').use(BuiltInStandardAttributes), + this.key('builtInDomainDefinedAttributes').optional().use(BuiltInDomainDefinedAttributes), + this.key('extensionAttributes').optional().use(ExtensionAttributes) + ); +}); + +var BuiltInStandardAttributes = +rfc5280.BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes', function() { + ; +}); + +var BuiltInDomainDefinedAttributes = +rfc5280.BuiltInDomainDefinedAttributes = asn1.define('BuiltInDomainDefinedAttributes', function() { + ; +}); + +var ExtensionAttributes = +rfc5280.ExtensionAttributes = asn1.define('ExtensionAttributes', function() { + ; +}); + +var EDIPartyName = rfc5280.EDIPartyName = asn1.define('EDIPartyName', function() { + this.seq().obj( + this.key('nameAssigner').optional().use(DirectoryString), + this.key('partyName').use(DirectoryString) + ); +}); + +var DirectoryString = rfc5280.DirectoryString = asn1.define('DirectoryString', function() { + this.choice({ + teletexString: this.use(TeletexString), + printableString: this.use(PrintableString), + universalString: this.use(UniversalString), + utf8String: this.use(UTF8String), + bmpString: this.use(BMPString) + }); +}); + +var TeletexString = +rfc5280.TeletexString = asn1.define('TeletexString', function() { + ; +}); + +var PrintableString = +rfc5280.PrintableString = asn1.define('PrintableString', function() { + ; +}); + +var UniversalString = +rfc5280.UniversalString = asn1.define('UniversalString', function() { + ; +}); + +var UTF8String = +rfc5280.UTF8String = asn1.define('UTF8String', function() { + ; +}); + +var BMPString = +rfc5280.BMPString = asn1.define('BMPString', function() { + ; +}); + // rfc5280.SubjectKeyIdentifier = asn1.define('SubjectKeyIdentifier', function() { // this.seq().obj( // this.key('keyIdentifier').optional().octstr(),