Comparing version 2.0.2 to 2.0.3
@@ -20,3 +20,3 @@ var inherits = require('inherits'); | ||
DecoderBuffer.prototype.save = function save() { | ||
return { offset: this.offset }; | ||
return { offset: this.offset, reporter: Reporter.prototype.save.call(this) }; | ||
}; | ||
@@ -31,2 +31,3 @@ | ||
this.offset = save.offset; | ||
Reporter.prototype.restore.call(this, save.reporter); | ||
@@ -70,3 +71,3 @@ return res; | ||
this.value = value.map(function(item) { | ||
if (!(item instanceof EncoderBuffer)) | ||
if (!item || item.constructor.name !== 'EncoderBuffer') | ||
item = new EncoderBuffer(item, reporter); | ||
@@ -73,0 +74,0 @@ this.length += item.length; |
@@ -17,2 +17,15 @@ var inherits = require('inherits'); | ||
Reporter.prototype.save = function save() { | ||
var state = this._reporterState; | ||
return { obj: state.obj, pathLen: state.path.length }; | ||
}; | ||
Reporter.prototype.restore = function restore(data) { | ||
var state = this._reporterState; | ||
state.obj = data.obj; | ||
state.path = state.path.slice(0, data.pathLen); | ||
}; | ||
Reporter.prototype.enterKey = function enterKey(key) { | ||
@@ -19,0 +32,0 @@ return this._reporterState.path.push(key); |
@@ -172,5 +172,5 @@ var inherits = require('inherits'); | ||
// Bignum, assume big endian | ||
if (bignum !== null && num instanceof bignum) { | ||
if (typeof num !== 'number' && !Buffer.isBuffer(num)) { | ||
var numArray = num.toArray(); | ||
if(num.sign === false && numArray[0] & 0x80) { | ||
if (num.sign === false && numArray[0] & 0x80) { | ||
numArray.unshift(0); | ||
@@ -177,0 +177,0 @@ } |
{ | ||
"name": "asn1.js", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "ASN.1 encoder and decoder", | ||
@@ -5,0 +5,0 @@ "main": "lib/asn1.js", |
@@ -9,2 +9,38 @@ try { | ||
var OCSPRequest = asn1.define('OCSPRequest', function() { | ||
this.seq().obj( | ||
this.key('tbsRequest').use(TBSRequest), | ||
this.key('optionalSignature').optional().explicit(0).use(Signature) | ||
); | ||
}); | ||
exports.OCSPRequest = OCSPRequest; | ||
var TBSRequest = asn1.define('TBSRequest', function() { | ||
this.seq().obj( | ||
this.key('version').def('v1').explicit(0).use(rfc3280.Version), | ||
this.key('requestorName').optional().explicit(1).use(rfc3280.GeneralName), | ||
this.key('requestList').seqof(Request), | ||
this.key('requestExtensions').optional().explicit(2).use(rfc3280.Extensions) | ||
); | ||
}); | ||
exports.TBSRequest = TBSRequest; | ||
var Signature = asn1.define('Signature', function() { | ||
this.seq().obj( | ||
this.key('signatureAlgorithm').use(rfc3280.AlgorithmIdentifier), | ||
this.key('signature').bitstr(), | ||
this.key('certs').optional().explicit(0).seqof(rfc3280.Certificate) | ||
); | ||
}); | ||
exports.Signature = Signature; | ||
var Request = asn1.define('Request', function() { | ||
this.seq().obj( | ||
this.key('reqCert').use(CertID), | ||
this.key('singleRequestExtensions').optional().explicit(0).use( | ||
rfc3280.Extensions) | ||
); | ||
}); | ||
exports.Request = Request; | ||
var OCSPResponse = asn1.define('OCSPResponse', function() { | ||
@@ -76,3 +112,3 @@ this.seq().obj( | ||
this.key('nextUpdate').optional().explicit(0).gentime(), | ||
this.key('singleExtensions').optional().explicit(1).use(Extensions) | ||
this.key('singleExtensions').optional().explicit(1).use(rfc3280.Extensions) | ||
); | ||
@@ -109,5 +145,8 @@ }); | ||
var Extensions = asn1.define('Extensions', function() { | ||
this.any(); | ||
var Nonce = asn1.define('Nonce', function() { | ||
this.octstr(); | ||
}); | ||
exports.Extensions = Extensions; | ||
exports.Nonce = Nonce; | ||
exports['id-pkix-ocsp'] = [ 1, 3, 6, 1, 5, 5, 7, 48, 1 ]; | ||
exports['id-pkix-ocsp-nonce'] = [ 1, 3, 6, 1, 5, 5, 7, 48, 1, 2 ]; |
{ | ||
"name": "asn1.js-rfc2560", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "RFC2560 structures for asn1.js", | ||
@@ -22,7 +22,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"asn1.js-rfc3280": "^1.0.0" | ||
"asn1.js-rfc3280": "^2.0.0" | ||
}, | ||
"peerDependencies": { | ||
"asn1.js": "^1.0.0" | ||
"asn1.js": "^2.0.0" | ||
} | ||
} |
@@ -153,1 +153,48 @@ try { | ||
exports.AttributeValue = AttributeValue; | ||
var GeneralNames = asn1.define('GeneralNames', function() { | ||
this.seqof(GeneralName); | ||
}); | ||
exports.GeneralNames = GeneralNames; | ||
var GeneralName = asn1.define('GeneralName', function() { | ||
return this.choice({ | ||
otherName: this.implicit(0).use(AnotherName), | ||
rfc822Name: this.implicit(1).ia5str(), | ||
dNSName: this.implicit(2).ia5str(), | ||
directoryName: this.implicit(4).use(Name), | ||
// TODO(indutny): requires DirectoryString, ORAddress | ||
// ediPartyName: this.implicit(5).use(EDIPartyName), | ||
// x400Address: this.implicit(3).use(ORAddress), | ||
uniformResourceIdentifier: this.implicit(6).ia5str(), | ||
iPAddress: this.implicit(7).octstr(), | ||
registeredID: this.implicit(8).objid() | ||
}); | ||
}); | ||
exports.GeneralName = GeneralName; | ||
var AnotherName = asn1.define('AnotherName', function() { | ||
return this.seq().obj( | ||
this.key('type-id').objid(), | ||
this.key('value').explicit(0).any() | ||
); | ||
}); | ||
exports.AnotherName = AnotherName; | ||
exports['id-pe-authorityInfoAccess'] = [ 1, 3, 6, 1, 5, 5, 7, 1, 1]; | ||
var AuthorityInfoAccessSyntax = asn1.define('AuthorityInfoAccessSyntax', | ||
function() { | ||
this.seqof(AccessDescription); | ||
}); | ||
exports.AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax; | ||
var AccessDescription = asn1.define('AccessDescription', function() { | ||
this.seq().obj( | ||
this.key('accessMethod').objid(), | ||
this.key('accessLocation').use(GeneralName) | ||
); | ||
}); | ||
exports.AccessDescription = AccessDescription; |
{ | ||
"name": "asn1.js-rfc3280", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "RFC3280 structures for asn1.js", | ||
@@ -22,4 +22,4 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"asn1.js": "^1.0.0" | ||
"asn1.js": "^2.0.0" | ||
} | ||
} |
@@ -110,2 +110,14 @@ var assert = require('assert'); | ||
}); | ||
it('should decode AuthorityInfoAccess', function() { | ||
var data = new Buffer('305a302b06082b06010505073002861f687474703a2f2f70' + | ||
'6b692e676f6f676c652e636f6d2f47494147322e63727430' + | ||
'2b06082b06010505073001861f687474703a2f2f636c6965' + | ||
'6e7473312e676f6f676c652e636f6d2f6f637370', | ||
'hex'); | ||
var info = rfc3280.AuthorityInfoAccessSyntax.decode(data, 'der'); | ||
assert(info[0].accessMethod); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77846
2215