How to use the asn1.js-rfc2560.OCSPResponse function in asn1

To help you get started, we’ve selected a few asn1 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github indutny / ocsp / lib / ocsp / utils.js View on Github external
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);
github indutny / ocsp / lib / ocsp / server.js View on Github external
function errRes(status) {
    return rfc2560.OCSPResponse.encode({
      responseStatus: status
    }, 'der');
  }