Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
issuer = rawIssuer;
} else {
issuer = rfc5280.Certificate.decode(
ocsp.utils.toDER(rawIssuer, 'CERTIFICATE'),
'der');
}
var tbsCert = cert.tbsCertificate;
var tbsIssuer = issuer.tbsCertificate;
var certID = {
hashAlgorithm: {
// algorithm: [ 2, 16, 840, 1, 101, 3, 4, 2, 1 ] // sha256
algorithm: [ 1, 3, 14, 3, 2, 26 ] // sha1
},
issuerNameHash: sha1(rfc5280.Name.encode(tbsCert.issuer, 'der')),
issuerKeyHash: sha1(
tbsIssuer.subjectPublicKeyInfo.subjectPublicKey.data),
serialNumber: tbsCert.serialNumber
};
var tbs = {
version: 'v1',
requestList: [ {
reqCert: certID
} ],
requestExtensions: [ {
extnID: rfc2560['id-pkix-ocsp-nonce'],
critical: false,
extnValue: rfc2560.Nonce.encode(crypto.randomBytes(16), 'der')
} ]
};
}
}
catch (e)
{
return null; // if we encountered an error during decoding, return null
}
var tbsCert = cert.tbsCertificate;
var tbsIssuer = issuer.tbsCertificate;
const certID = {
hashAlgorithm: {
// algorithm: [ 2, 16, 840, 1, 101, 3, 4, 2, 1 ] // sha256
algorithm: [1, 3, 14, 3, 2, 26] // sha1
},
issuerNameHash: sha1(rfc5280.Name.encode(tbsCert.issuer, 'der')),
issuerKeyHash: sha1(
tbsIssuer.subjectPublicKeyInfo.subjectPublicKey.data),
serialNumber: tbsCert.serialNumber
};
const certIDDer = rfc2560.CertID.encode(certID, 'der');
return encodeKey(certIDDer.toString("BASE64"));
};
var ResponderID = asn1.define('ResponderId', function() {
this.choice({
byName: this.explicit(1).use(rfc5280.Name),
byKey: this.explicit(2).use(KeyHash)
});
});
exports.ResponderID = ResponderID;
var ResponderID = asn1.define('ResponderId', function() {
this.choice({
byName: this.explicit(1).use(rfc5280.Name),
byKey: this.explicit(2).use(KeyHash)
});
});
exports.ResponderID = ResponderID;
var ResponderID = asn1.define('ResponderId', function() {
this.choice({
byName: this.explicit(1).use(rfc5280.Name),
byKey: this.explicit(2).use(KeyHash)
});
});
exports.ResponderID = ResponderID;
function Server(options) {
http.Server.call(this, this.handler);
this.options = util._extend({
nextUpdate: 24 * 3600 * 1e3
}, options);
this.key = this.options.key;
this.cert = rfc5280.Certificate.decode(
ocsp.utils.toDER(options.cert, 'CERTIFICATE'),
'der');
this.cert = this.cert.tbsCertificate;
var issuerName = rfc5280.Name.encode(this.cert.subject, 'der');
var issuerKey = this.cert.subjectPublicKeyInfo.subjectPublicKey.data;
this.certID = {};
Object.keys(ocsp.utils.digestRev).forEach(function(digest) {
this.certID[digest] = {
issuerNameHash: crypto.createHash(digest).update(issuerName).digest(),
issuerKeyHash: crypto.createHash(digest).update(issuerKey).digest()
};
}, this);
this.certs = {};
}
util.inherits(Server, http.Server);