Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.parseResponse = function parseResponse(raw) {
var body = { start: 0, end: raw.length };
var response = rfc2560.OCSPResponse.decode(raw, 'der', {
track: function(key, start, end, type) {
if (type !== 'content' || key !== 'responseBytes/response')
return;
body.start = start;
body.end = end;
}
});
var status = response.responseStatus;
if (status !== 'successful')
throw new Error('Bad OCSP response status: ' + status);
// Unknown response type
var responseType = response.responseBytes.responseType;
if (responseType !== 'id-pkix-ocsp-basic')
throw new Error('Unknown OCSP response type: ' + responseType);
function errRes(status) {
return rfc2560.OCSPResponse.encode({
responseStatus: status
}, 'der');
}