Class Index | File Index

Classes


Class KJUR.asn1.ocsp.OCSPParser

OCSP request and response parser
Defined in: asn1ocsp-1.0.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
OCSP request and response parser
This class provides ASN.1 parser for OCSP related ASN.1 data.
Method Summary
Method Attributes Method Name and Description
 
parse ASN.1 BasicOCSPResponse of OCSP
This method will parse a hexadecimal string of BasicOCSPResponse defined in RFC 6960 4.2.1.
 
parse ASN.1 CertID of OCSP
This method will parse a hexadecimal string of CertID ASN.1 class is defined in RFC 6960 4.1.1.
 
parse ASN.1 CertStatus of OCSP
CertStatus ::= CHOICE {
    good        [0]     IMPLICIT NULL,
    revoked     [1]     IMPLICIT RevokedInfo,
    unknown     [2]     IMPLICIT UnknownInfo }
RevokedInfo ::= SEQUENCE {
    revocationTime              GeneralizedTime,
    revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }
UnknownInfo ::= NULL
NOTE: Currently revocationReason not supported.
 
parse ASN.1 OCSPRequest
This method will parse a hexadecimal string of OCSPRequest ASN.1 class is defined in RFC 6960 4.1.1.
 
parse ASN.1 OCSPResponse of OCSP
This method will parse a hexadecimal string of ASN.1 OCSPResponse defined in RFC 6960 4.2.1.
 
parse ASN.1 Request of OCSP
This method will parse a hexadecimal string of Request ASN.1 class is defined in RFC 6960 4.1.1.
 
parse ASN.1 SEQUENCE OF Request in OCSP
This method will parse a hexadecimal string of SEQUENCE OF Request ASN.1 class is defined in RFC 6960 4.1.1.
 
parse ASN.1 ResponderID of OCSP
ResponderID ::= CHOICE {
   byName               [1] Name,
   byKey                [2] KeyHash }
KeyHash ::= OCTET STRING -- SHA-1 hash of responder's public key
                            (excluding the tag and length fields)
 
parse ASN.1 ResponseBytes of OCSP
This method will parse a hexadecimal string of ASN.1 ResponseBytes defined in RFC 6960 4.2.1.
 
parse ASN.1 ResponseData of OCSP
This method will parse a hexadecimal string of ASN.1 ResponseData defined in RFC 6960 4.2.1.
 
parse ASN.1 SingleResponse of OCSP
This method will parse a hexadecimal string of ASN.1 class of SingleResponse is defined in RFC 6960 4.2.1.
 
parse ASN.1 SEQUENCE OF SingleResponse of OCSP
This method will parse a hexadecimal string of ASN.1 class of SEQUENCE OF SingleResponse is defined in RFC 6960 4.2.1.
 
parse ASN.1 TBSRequest of OCSP
This method will parse TBSRequest ASN.1 class is defined in RFC 6960 4.1.1.
Class Detail
KJUR.asn1.ocsp.OCSPParser()
OCSP request and response parser
This class provides ASN.1 parser for OCSP related ASN.1 data.
NOTE: OCSPResponse parser supported from jsrsasign 10.4.0.
This parser supports following OCSP ASN.1 classes:
Since:
jsrsasign 9.1.6 asn1ocsp 1.1.0
Method Detail
getBasicOCSPResponse(h)
parse ASN.1 BasicOCSPResponse of OCSP
This method will parse a hexadecimal string of BasicOCSPResponse defined in RFC 6960 4.2.1.
BasicOCSPResponse       ::= SEQUENCE {
   tbsResponseData      ResponseData,
   signatureAlgorithm   AlgorithmIdentifier,
   signature            BIT STRING,
   certs            [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
o = new KJUR.asn1.ocsp.OCSPParser();
o.getBasicOCSPResponse("30..") →
{ ...<>...
  sigalg: "SHA256withRSA",
  sighex: "12abcd...",
  certs: [<>,...] });
Parameters:
{String} h
hexadecimal string of BasicOCSPResponse
Since:
jsrsasign 10.4.0 asn1ocsp 1.1.5
Returns:
JSON object of BasicOCSPResponse parameter
See:
KJUR.asn1.ocsp.OCSPParser#getResponseBytes
KJUR.asn1.ocsp.OCSPParser#getResponseData
KJUR.asn1.ocsp.BasicOCSPResponse

getCertID(h)
parse ASN.1 CertID of OCSP
This method will parse a hexadecimal string of CertID ASN.1 class is defined in RFC 6960 4.1.1.
CertID ::= SEQUENCE {
  hashAlgorithm   AlgorithmIdentifier,
  issuerNameHash  OCTET STRING, -- Hash of issuer's DN
  issuerKeyHash   OCTET STRING, -- Hash of issuer's public key
  serialNumber    CertificateSerialNumber }
o = new KJUR.asn1.ocsp.OCSPParser();
o.getCertID("30...") →
{ alg: "sha1"
  issname: "...hex...",
  isskey: "...hex...",
  sbjsn: "...hex..." }
Parameters:
{String} h
hexadecimal string of CertID
Since:
jsrsasign 9.1.6 asn1ocsp 1.1.0
Returns:
JSON object of CertID parameter
See:
KJUR.asn1.ocsp.OCSPParser#getRequest
KJUR.asn1.ocsp.OCSPParser#getSingleResponse
KJUR.asn1.ocsp.CertID

getCertStatus(h)
parse ASN.1 CertStatus of OCSP
CertStatus ::= CHOICE {
    good        [0]     IMPLICIT NULL,
    revoked     [1]     IMPLICIT RevokedInfo,
    unknown     [2]     IMPLICIT UnknownInfo }
RevokedInfo ::= SEQUENCE {
    revocationTime              GeneralizedTime,
    revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }
UnknownInfo ::= NULL
NOTE: Currently revocationReason not supported.
o = new KJUR.asn1.ocsp.OCSPParser();
o.getCertStatus("8000") → {status: "good"}
o.getCertStatus("8200") → {status: "unknown"}
o.getCertStatus("a1..") → {status: "revoked", time: "2021...Z"}
Parameters:
{String} h
hexadecimal string of CertStatus
Since:
jsrsasign 10.4.0 asn1ocsp 1.1.5
Returns:
JSON object of CertStatus parameter
See:
KJUR.asn1.ocsp.CertStatus

{Array} getOCSPRequest(h)
parse ASN.1 OCSPRequest
This method will parse a hexadecimal string of OCSPRequest ASN.1 class is defined in RFC 6960 4.1.1.
OCSPRequest ::= SEQUENCE {
  tbsRequest              TBSRequest,
  optionalSignature  [0]  EXPLICIT Signature OPTIONAL }
TBSRequest  ::=  SEQUENCE {
  version            [0]  EXPLICIT Version DEFAULT v1,
  requestorName      [1]  EXPLICIT GeneralName OPTIONAL,
  requestList             SEQUENCE OF Request,
  requestExtensions  [2]  EXPLICIT Extensions OPTIONAL }
Signature       ::=     SEQUENCE {
  signatureAlgorithm      AlgorithmIdentifier,
  signature               BIT STRING,
  certs              [0] EXPLICIT SEQUENCE OF Certificate
                         OPTIONAL}
Currently Signature in OCSPRequest is not supported.
o = new KJUR.asn1.ocsp.OCSPParser();
o.getOCSPRequest("30...") →
{ array: [{
   "alg": "sha1",
   "issname": "105fa67a80089db5279f35ce830b43889ea3c70d",
   "isskey": "0f80611c823161d52f28e78d4638b42ce1c6d9e2",
   "sbjsn": "0fef62075d715dc5e1d8bd03775c9686" }]}
Parameters:
{String} h
hexadecimal string of ASN.1 OCSPRequest
Since:
jsrsasign 9.1.6 asn1ocsp 1.1.0
Returns:
{Array} array of JSON object of OCSPRequest parameter
See:
KJUR.asn1.ocsp.OCSPParser#getTBSRequest
KJUR.asn1.ocsp.OCSPRequest

getOCSPResponse(h)
parse ASN.1 OCSPResponse of OCSP
This method will parse a hexadecimal string of ASN.1 OCSPResponse defined in RFC 6960 4.2.1.
OCSPResponse ::= SEQUENCE {
   responseStatus         OCSPResponseStatus,
   responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL }
OCSPResponseStatus ::= ENUMERATED {
    successful            (0),  -- Response has valid confirmations
    malformedRequest      (1),  -- Illegal confirmation request
    internalError         (2),  -- Internal error in issuer
    tryLater              (3),  -- Try again later
                                -- (4) is not used
    sigRequired           (5),  -- Must sign the request
    unauthorized          (6)   -- Request unauthorized }
o = new KJUR.asn1.ocsp.OCSPParser();
o.getOCSPResponse("30..") →
{ resstatus: 0,
  restype: "ocspBasic",
  respid: {key: "12ab"},
  prodat: "20200903235959Z",
  array: [{
    certid: {alg:"sha1",issname:"12ab",isskey:"12ab",sbjsn:"12ab"},
    status: {status: "good"},
    thisupdate: "20200903235959Z" }],
  ext: [{extname: "ocspNonce", hex: "1234abcd"}],
  alg: "SHA256withRSA",
  sighex: "12ab",
  certs: ["3082...", "3082..."] }
Parameters:
{String} h
hexadecimal string of OCSPResponse
Since:
jsrsasign 10.4.0 asn1ocsp 1.1.5
Returns:
JSON object of OCSResponse parameter
See:
KJUR.asn1.ocsp.OCSPParser#getResponseBytes
KJUR.asn1.ocsp.OCSPResponse

getRequest(h)
parse ASN.1 Request of OCSP
This method will parse a hexadecimal string of Request ASN.1 class is defined in RFC 6960 4.1.1.
Request ::= SEQUENCE {
  reqCert                  CertID,
  singleRequestExtensions  [0] EXPLICIT Extensions OPTIONAL }      
o = new KJUR.asn1.ocsp.OCSPParser();
o.getRequest("30...") →
{ alg: "sha1"
  issname: "...hex...",
  isskey: "...hex...",
  sbjsn: "...hex...",
  ext: [<>...] }
Parameters:
{String} h
hexadecimal string of ASN.1 Request of OCSP
Since:
jsrsasign 9.1.6 asn1ocsp 1.1.0
Returns:
JSON object of Request parameter
See:
KJUR.asn1.ocsp.OCSPParser#getTBSRequest
KJUR.asn1.ocsp.OCSPParser#getRequestList
KJUR.asn1.ocsp.OCSPParser#getCertID
KJUR.asn1.ocsp.RequestList
KJUR.asn1.ocsp.Request
KJUR.asn1.ocsp.CertID

{Array} getRequestList(h)
parse ASN.1 SEQUENCE OF Request in OCSP
This method will parse a hexadecimal string of SEQUENCE OF Request ASN.1 class is defined in RFC 6960 4.1.1.
NOTE: singleRequestExtensions is not supported yet in this version such as nonce.
TBSRequest  ::=  SEQUENCE {
  version            [0]  EXPLICIT Version DEFAULT v1,
  requestorName      [1]  EXPLICIT GeneralName OPTIONAL,
  requestList             SEQUENCE OF Request,
  requestExtensions  [2]  EXPLICIT Extensions OPTIONAL }
Request ::= SEQUENCE {
  reqCert                  CertID,
  singleRequestExtensions  [0] EXPLICIT Extensions OPTIONAL }      
o = new KJUR.asn1.ocsp.OCSPParser();
o.getRequestList("30...") →
[{ alg: "sha1"
  issname: "...hex...",
  isskey: "...hex...",
  sbjsn: "...hex...",
  ext: [<>...] }]
Parameters:
{String} h
hexadecimal string of ASN.1 SEQUENCE OF Request in OCSP
Since:
jsrsasign 9.1.6 asn1ocsp 1.1.0
Returns:
{Array} array of JSON object of Request parameter
See:
KJUR.asn1.ocsp.OCSPParser#getTBSRequest
KJUR.asn1.ocsp.OCSPParser#getRequest
KJUR.asn1.ocsp.RequestList
KJUR.asn1.ocsp.Request

getResponderID(h)
parse ASN.1 ResponderID of OCSP
ResponderID ::= CHOICE {
   byName               [1] Name,
   byKey                [2] KeyHash }
KeyHash ::= OCTET STRING -- SHA-1 hash of responder's public key
                            (excluding the tag and length fields)
o = new KJUR.asn1.ocsp.OCSPParser();
o.getResponderID("a1..") → {name: {array: [[{type:"C",value:"JP",ds:"prn"}]...]}}
o.getResponderID("a2..") → {key: "12ab..."}
Parameters:
{String} h
hexadecimal string of ResponderID
Since:
jsrsasign 10.4.0 asn1ocsp 1.1.5
Returns:
JSON object of ResponderID parameter
See:
KJUR.asn1.ocsp.ResponderID

getResponseBytes(h)
parse ASN.1 ResponseBytes of OCSP
This method will parse a hexadecimal string of ASN.1 ResponseBytes defined in RFC 6960 4.2.1.
ResponseBytes ::=       SEQUENCE {
    responseType   OBJECT IDENTIFIER,
    response       OCTET STRING }
id-pkix-ocsp           OBJECT IDENTIFIER ::= { id-ad-ocsp }
id-pkix-ocsp-basic     OBJECT IDENTIFIER ::= { id-pkix-ocsp 1 }

BasicOCSPResponse       ::= SEQUENCE {
   tbsResponseData      ResponseData,
   signatureAlgorithm   AlgorithmIdentifier,
   signature            BIT STRING,
   certs            [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
o = new KJUR.asn1.ocsp.OCSPParser();
o.getResponseBytes("30..") →
{ restype: "ocspBasic",
  ...<>...
Parameters:
{String} h
hexadecimal string of ResponseBytes
Since:
jsrsasign 10.4.0 asn1ocsp 1.1.5
Returns:
JSON object of ResponseBytes parameter
See:
KJUR.asn1.ocsp.OCSPParser#getOCSPResponse
KJUR.asn1.ocsp.OCSPParser#getBasicOCSPResponse
KJUR.asn1.ocsp.ResponseBytes

getResponseData(h)
parse ASN.1 ResponseData of OCSP
This method will parse a hexadecimal string of ASN.1 ResponseData defined in RFC 6960 4.2.1.
ResponseData ::= SEQUENCE {
   version              [0] EXPLICIT Version DEFAULT v1,
   responderID              ResponderID,
   producedAt               GeneralizedTime,
   responses                SEQUENCE OF SingleResponse,
   responseExtensions   [1] EXPLICIT Extensions OPTIONAL }
o = new KJUR.asn1.ocsp.OCSPParser();
o.getResponseData("30..") →
{ respid: {key: "12ab..."},
  prodat: "20200903235959Z",
  array: [<>, ...],
  ext: [
    {extname:"ocspNonce",hex:"12ab..."}]}
Parameters:
{String} h
hexadecimal string of ResponseData
Since:
jsrsasign 10.4.0 asn1ocsp 1.1.5
Returns:
JSON object of ResponseData parameter
See:
KJUR.asn1.ocsp.OCSPParser#getBasicOCSPResponse
KJUR.asn1.ocsp.OCSPParser#getSingleResponse
KJUR.asn1.ocsp.ResponseData

getSingleResponse(h)
parse ASN.1 SingleResponse of OCSP
This method will parse a hexadecimal string of ASN.1 class of SingleResponse is defined in RFC 6960 4.2.1.
SingleResponse ::= SEQUENCE {
   certID                       CertID,
   certStatus                   CertStatus,
   thisUpdate                   GeneralizedTime,
   nextUpdate         [0]       EXPLICIT GeneralizedTime OPTIONAL,
   singleExtensions   [1]       EXPLICIT Extensions OPTIONAL }
o = new KJUR.asn1.ocsp.OCSPParser();
o.getSingleResponse("30..") →
{ certid: {alg:"sha1",issname:"12ab",isskey:"12ab",sbjsn:"12ab"},
  status: {status: "good"},
  thisupdate: "20200903235959Z",
  nextupdate: "20200913235959Z",
  ext: [<>...] }
Parameters:
{String} h
hexadecimal string of SingleResponse
Since:
jsrsasign 10.4.0 asn1ocsp 1.1.5
Returns:
JSON object of SingleResponse parameter
See:
KJUR.asn1.ocsp.OCSPParse#getSingleResponseList
KJUR.asn1.ocsp.OCSPParse#getCertID
KJUR.asn1.ocsp.SingleResponse

getSingleResponseList(h)
parse ASN.1 SEQUENCE OF SingleResponse of OCSP
This method will parse a hexadecimal string of ASN.1 class of SEQUENCE OF SingleResponse is defined in RFC 6960 4.2.1.
ResponseData ::= SEQUENCE {
   version              [0] EXPLICIT Version DEFAULT v1,
   responderID              ResponderID,
   producedAt               GeneralizedTime,
   responses                SEQUENCE OF SingleResponse,
   responseExtensions   [1] EXPLICIT Extensions OPTIONAL }
SingleResponse ::= SEQUENCE {
   certID                       CertID,
   certStatus                   CertStatus,
   thisUpdate                   GeneralizedTime,
   nextUpdate         [0]       EXPLICIT GeneralizedTime OPTIONAL,
   singleExtensions   [1]       EXPLICIT Extensions OPTIONAL }
o = new KJUR.asn1.ocsp.OCSPParser();
o.getSingleResponseList("30..") →
[{ certid: {alg:"sha1",issname:"12ab",isskey:"12ab",sbjsn:"12ab"},
   status: {status: "good"},
   thisupdate: "20200903235959Z",
   nextupdate: "20200913235959Z",
   ext: [<>...] }]
Parameters:
{String} h
hexadecimal string of SEQUENCE OF SingleResponse
Since:
jsrsasign 10.4.0 asn1ocsp 1.1.5
Returns:
array of SingleResponse parameter JSON object
See:
KJUR.asn1.ocsp.OCSPParse#getResponseData
KJUR.asn1.ocsp.OCSPParse#getSingleResponse
KJUR.asn1.ocsp.OCSPParse#getCertID
KJUR.asn1.ocsp.SingleResponseList

{Array} getTBSRequest(h)
parse ASN.1 TBSRequest of OCSP
This method will parse TBSRequest ASN.1 class is defined in RFC 6960 4.1.1.
TBSRequest  ::=  SEQUENCE {
  version            [0]  EXPLICIT Version DEFAULT v1,
  requestorName      [1]  EXPLICIT GeneralName OPTIONAL,
  requestList             SEQUENCE OF Request,
  requestExtensions  [2]  EXPLICIT Extensions OPTIONAL }
o = new KJUR.asn1.ocsp.OCSPParser();
o.getTBSRequest("30...") →
{array: [{
  "alg": "sha1",
  "issname": "105fa67a80089db5279f35ce830b43889ea3c70d",
  "isskey": "0f80611c823161d52f28e78d4638b42ce1c6d9e2",
  "sbjsn": "0fef62075d715dc5e1d8bd03775c9686" }]}
Parameters:
{String} h
hexadecimal string of ASN.1 TBSRequest of OCSP
Since:
jsrsasign 9.1.6 asn1ocsp 1.1.0
Returns:
{Array} array of JSON object of TBSRequest parameter
See:
KJUR.asn1.ocsp.OCSPParser#getOCSPRequest
KJUR.asn1.ocsp.OCSPParser#getRequestList
KJUR.asn1.ocsp.TBSRequest

© 2012-2023 Kenji Urushima, All rights reserved
Documentation generated by JsDoc Toolkit 2.4.0