react / wstein / node_modules / browserify / node_modules / crypto-browserify / node_modules / browserify-sign / node_modules / parse-asn1 / node_modules / asn1.js / rfc / 3280 / index.js
80645 viewstry {1var asn1 = require('asn1.js');2} catch (e) {3var asn1 = require('../' + '..');4}56var CRLReason = asn1.define('CRLReason', function() {7this.enum({80: 'unspecified',91: 'keyCompromise',102: 'CACompromise',113: 'affiliationChanged',124: 'superseded',135: 'cessationOfOperation',146: 'certificateHold',158: 'removeFromCRL',169: 'privilegeWithdrawn',1710: 'AACompromise'18});19});20exports.CRLReason = CRLReason;2122var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() {23this.seq().obj(24this.key('algorithm').objid(),25this.key('parameters').optional().any()26);27});28exports.AlgorithmIdentifier = AlgorithmIdentifier;2930var Certificate = asn1.define('Certificate', function() {31this.seq().obj(32this.key('tbsCertificate').use(TBSCertificate),33this.key('signatureAlgorithm').use(AlgorithmIdentifier),34this.key('signature').bitstr()35);36});37exports.Certificate = Certificate;3839var TBSCertificate = asn1.define('TBSCertificate', function() {40this.seq().obj(41this.key('version').def('v1').explicit(0).use(Version),42this.key('serialNumber').use(CertificateSerialNumber),43this.key('signature').use(AlgorithmIdentifier),44this.key('issuer').use(Name),45this.key('validity').use(Validity),46this.key('subject').use(Name),47this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo),4849// TODO(indutny): validate that version is v2 or v350this.key('issuerUniqueID').optional().explicit(1).use(UniqueIdentifier),51this.key('subjectUniqueID').optional().explicit(2).use(UniqueIdentifier),5253// TODO(indutny): validate that version is v354this.key('extensions').optional().explicit(3).use(Extensions)55);56});57exports.TBSCertificate = TBSCertificate;5859var Version = asn1.define('Version', function() {60this.int({610: 'v1',621: 'v2',632: 'v3'64});65});66exports.Version = Version;6768var CertificateSerialNumber = asn1.define('CertificateSerialNumber',69function() {70this.int();71});72exports.CertificateSerialNumber = CertificateSerialNumber;7374var Validity = asn1.define('Validity', function() {75this.seq().obj(76this.key('notBefore').use(Time),77this.key('notAfter').use(Time)78);79});80exports.Validity = Validity;8182var Time = asn1.define('Time', function() {83this.choice({84utcTime: this.utctime(),85genTime: this.gentime()86});87});88exports.Time = Time;8990var UniqueIdentifier = asn1.define('UniqueIdentifier', function() {91this.bitstr();92});93exports.UniqueIdentifier = UniqueIdentifier;9495var SubjectPublicKeyInfo = asn1.define('SubjectPublicKeyInfo', function() {96this.seq().obj(97this.key('algorithm').use(AlgorithmIdentifier),98this.key('subjectPublicKey').bitstr()99);100});101exports.SubjectPublicKeyInfo = SubjectPublicKeyInfo;102103var Extensions = asn1.define('Extensions', function() {104this.seqof(Extension);105});106exports.Extensions = Extensions;107108var Extension = asn1.define('Extension', function() {109this.seq().obj(110this.key('extnID').objid(),111this.key('critical').bool().def(false),112this.key('extnValue').octstr()113);114});115exports.Extension = Extension;116117var Name = asn1.define('Name', function() {118this.choice({119rdn: this.use(RDNSequence)120});121});122exports.Name = Name;123124var RDNSequence = asn1.define('RDNSequence', function() {125this.seqof(RelativeDistinguishedName);126});127exports.RDNSequence = RDNSequence;128129var RelativeDistinguishedName = asn1.define('RelativeDistinguishedName',130function() {131this.setof(AttributeTypeAndValue);132});133exports.RelativeDistinguishedName = RelativeDistinguishedName;134135var AttributeTypeAndValue = asn1.define('AttributeTypeAndValue', function() {136this.seq().obj(137this.key('type').use(AttributeType),138this.key('value').use(AttributeValue)139);140});141exports.AttributeTypeAndValue = AttributeTypeAndValue;142143var AttributeType = asn1.define('AttributeType', function() {144this.objid();145});146exports.AttributeType = AttributeType;147148var AttributeValue = asn1.define('AttributeValue', function() {149this.any();150});151exports.AttributeValue = AttributeValue;152153var GeneralNames = asn1.define('GeneralNames', function() {154this.seqof(GeneralName);155});156exports.GeneralNames = GeneralNames;157158var GeneralName = asn1.define('GeneralName', function() {159return this.choice({160otherName: this.implicit(0).use(AnotherName),161rfc822Name: this.implicit(1).ia5str(),162dNSName: this.implicit(2).ia5str(),163directoryName: this.implicit(4).use(Name),164165// TODO(indutny): requires DirectoryString, ORAddress166// ediPartyName: this.implicit(5).use(EDIPartyName),167// x400Address: this.implicit(3).use(ORAddress),168169uniformResourceIdentifier: this.implicit(6).ia5str(),170iPAddress: this.implicit(7).octstr(),171registeredID: this.implicit(8).objid()172});173});174exports.GeneralName = GeneralName;175176var AnotherName = asn1.define('AnotherName', function() {177return this.seq().obj(178this.key('type-id').objid(),179this.key('value').explicit(0).any()180);181});182exports.AnotherName = AnotherName;183184exports['id-pe-authorityInfoAccess'] = [ 1, 3, 6, 1, 5, 5, 7, 1, 1];185186var AuthorityInfoAccessSyntax = asn1.define('AuthorityInfoAccessSyntax',187function() {188this.seqof(AccessDescription);189});190exports.AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax;191192var AccessDescription = asn1.define('AccessDescription', function() {193this.seq().obj(194this.key('accessMethod').objid(),195this.key('accessLocation').use(GeneralName)196);197});198exports.AccessDescription = AccessDescription;199200201