Class Index | File Index

Classes


Class KJUR.asn1.tsp.TSPParser

RFC 3161 TimeStamp protocol parser class
Defined in: asn1tsp-1.0.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
class for parsing RFC 3161 TimeStamp protocol data
This is an ASN.1 parser for RFC 3161.
Method Summary
Method Attributes Method Name and Description
 
parse ASN.1 Accuracy
This method parses ASN.1 Accuracy defined in RFC 3161.
 
parse ASN.1 MessageImprint
This method parses ASN.1 MessageImprint defined in RFC 3161.
 
parse ASN.1 PKIFailureInfo
This method parses ASN.1 PKIFailureInfo defined in RFC 3161.
 
parse ASN.1 PKIFreeText
This method parses ASN.1 PKIFreeText defined in RFC 3161.
 
parse ASN.1 PKIStatusInfo
This method parses ASN.1 PKIStatusInfo defined in RFC 3161.
 
parse ASN.1 TimeStampResp
This method parses ASN.1 TimeStampRsp defined in RFC 3161.
 
parse hexadecimal string of TimeStampReq
This method parses a hexadecimal string of TimeStampReq and returns parsed their fields:
 
parse ASN.1 TimeStampToken
This method parses ASN.1 TimeStampRsp defined in RFC 3161.
 
parse ASN.1 TSTInfo
This method parses ASN.1 TSTInfo defined in RFC 3161.
 
setTSTInfo(pCMSSignedData)
set ASN.1 TSTInfo parameter to CMS SignedData parameter
This method modifies "econtent.content" of CMS SignedData parameter to parsed TSTInfo.
Class Detail
KJUR.asn1.tsp.TSPParser()
class for parsing RFC 3161 TimeStamp protocol data
This is an ASN.1 parser for RFC 3161.
Since:
jsrsasign 10.1.0 asn1tsp 2.0.1
Method Detail
{Array} getAccuracy(h)
parse ASN.1 Accuracy
This method parses ASN.1 Accuracy defined in RFC 3161.
Accuracy ::= SEQUENCE {
   seconds        INTEGER              OPTIONAL,
   millis     [0] INTEGER  (1..999)    OPTIONAL,
   micros     [1] INTEGER  (1..999)    OPTIONAL  }
parser = new KJUR.asn1.tsp.TSPParser();
parser.getAccuracy("30...") → {millis: 500}
Parameters:
{String} h
hexadecimal string of ASN.1 Accuracy
Returns:
{Array} JSON object of Accuracy parameter
See:
KJUR.asn1.tsp.Accuracy

{Array} getMessageImprint(h)
parse ASN.1 MessageImprint
This method parses ASN.1 MessageImprint defined in RFC 3161.
parser = new KJUR.asn1.tsp.TSPParser();
parser.getMessageImprint("30...") → 
{ alg: "sha256", hash: "12ab..." }
Parameters:
{String} h
hexadecimal string of ASN.1 MessageImprint
Returns:
{Array} JSON object of MessageImprint parameter
See:
KJUR.asn1.tsp.MessageImprint

{Object} getPKIFailureInfo(h)
parse ASN.1 PKIFailureInfo
This method parses ASN.1 PKIFailureInfo defined in RFC 3161.
parser = new KJUR.asn1.tsp.TSPParser();
parser.getPKIFailureInfo("03020700") → "badAlg"
parser.getPKIFailureInfo("03020780") → 1
parser.getPKIFailureInfo("030203c8") → "systemFailure"
Parameters:
{String} h
hexadecimal string of ASN.1 PKIFailureInfo
Since:
jsrsasign 10.1.3 asn1tsp 2.0.3
Returns:
{Object} failureInfo string or number
See:
KJUR.asn1.tsp.PKIFailureInfo

{Array} getPKIFreeText(h)
parse ASN.1 PKIFreeText
This method parses ASN.1 PKIFreeText defined in RFC 3161.
parser = new KJUR.asn1.tsp.TSPParser();
parser.getPKIFreeText("300a0c036161610c03616161") → 
["aaa", "aaa"]
Parameters:
{String} h
hexadecimal string of ASN.1 PKIFreeText
Since:
jsrsasign 10.1.3 asn1tsp 2.0.3
Returns:
{Array} array of string
See:
KJUR.asn1.tsp.PKIFreeText

{Array} getPKIStatusInfo(h)
parse ASN.1 PKIStatusInfo
This method parses ASN.1 PKIStatusInfo defined in RFC 3161.
parser = new KJUR.asn1.tsp.TSPParser();
parser.getPKIStatusInfo("30...") → 
{ status: "rejection",
  statusstr: ["unsupported algorithm"],
  failinfo: "badAlg" }
Parameters:
{String} h
hexadecimal string of ASN.1 PKIStatusInfo
Returns:
{Array} JSON object of PKIStatusInfo parameter
See:
KJUR.asn1.tsp.PKIStatusInfo

{Array} getResponse(h)
parse ASN.1 TimeStampResp
This method parses ASN.1 TimeStampRsp defined in RFC 3161.
TimeStampResp ::= SEQUENCE {
  status          PKIStatusInfo,
  timeStampToken  TimeStampToken  OPTIONAL }
When "h" is a TSP error response, returned parameter contains "statusinfo" only.
parser = new KJUR.asn1.tsp.TSPParser();
parser.getResponse("30...") →
{ 
  statusinfo: 'granted',
  ... // almost the same as CMS SignedData parameters
  econtent: {
    type: "tstinfo",
    content: { // TSTInfo parameter
      policy: '1.2.3.4.5',
      messageImprint: {alg: 'sha256', hash: 'a1a2a3a4...'},
      serial: {'int': 3},
      genTime: {str: '20131231235959.123Z'},
      accuracy: {millis: 500},
      ordering: true,
      nonce: {int: 3}
    }
  },
  ...
}
Parameters:
{String} h
hexadecimal string of ASN.1 TimeStampResp
Returns:
{Array} JSON object of TimeStampResp parameter
See:
KJUR.asn1.tsp.TimeStampResp
KJUR.asn1.tsp.TimeStampToken
KJUR.asn1.cms.CMSParser#getCMSSignedData

{Array} getTimeStampReq(h)
parse hexadecimal string of TimeStampReq
This method parses a hexadecimal string of TimeStampReq and returns parsed their fields:
var parser = new KJUR.asn1.tsp.TSPParser();
parser.getTimeStampReq("302602...") →
{ messageImprint: {
      alg: 'sha256',          // MessageImprint hashAlg
      hash: 'a1a2a3a4...'},   // MessageImprint hashValue
  policy: '1.2.3.4.5',         // tsaPolicy (OPTION)
  nonce: '9abcf318...',        // nonce (OPTION)
  certreq: true }              // certReq (OPTION)
Parameters:
{String} h
hexadecimal string of TimeStampReq
Since:
jsrsasign 10.5.18 asn1tsp 2.0.6
Returns:
{Array} JSON object of parsed parameters
See:
KJUR.asn1.tsp.TimeStampReq
KJUR.asn1.tsp.TSPUtil.parseTimeStampReq

{Array} getToken(h)
parse ASN.1 TimeStampToken
This method parses ASN.1 TimeStampRsp defined in RFC 3161. This method will parse "h" as CMS SigneData by KJUR.asn1.cms.CMSParser#getCMSSignedData, then parse and modify "econtent.content" parameter by KJUR.asn1.tsp.TSPParser#setTSTInfo method.
parser = new KJUR.asn1.tsp.TSPParser();
parser.getToken("30...") →
{ 
  ... // almost the same as CMS SignedData parameters
  econtent: {
    type: "tstinfo",
    content: { // TSTInfo parameter
      policy: '1.2.3.4.5',
      messageImprint: {alg: 'sha256', hash: 'a1a2a3a4...'},
      serial: {'int': 3},
      genTime: {str: '20131231235959.123Z'},
      accuracy: {millis: 500},
      ordering: true,
      nonce: {int: 3}
    }
  },
  ...
}
Parameters:
{String} h
hexadecimal string of ASN.1 TimeStampToken
Returns:
{Array} JSON object of TimeStampToken parameter
See:
KJUR.asn1.tsp.TimeStampToken
KJUR.asn1.cms.CMSParser#getCMSSignedData
KJUR.asn1.tsp.TSPParser#setTSTInfo

{Array} getTSTInfo(h)
parse ASN.1 TSTInfo
This method parses ASN.1 TSTInfo defined in RFC 3161.
TSTInfo ::= SEQUENCE  {
   version          INTEGER  { v1(1) },
   policy           TSAPolicyId,
   messageImprint   MessageImprint,
   serialNumber     INTEGER,
   genTime          GeneralizedTime,
   accuracy         Accuracy                 OPTIONAL,
   ordering         BOOLEAN             DEFAULT FALSE,
   nonce            INTEGER                  OPTIONAL,
   tsa              [0] GeneralName          OPTIONAL,
   extensions       [1] IMPLICIT Extensions  OPTIONAL }
parser = new KJUR.asn1.tsp.TSPParser();
parser.getTSTInfo("30...") →
{
  policy: '1.2.3.4.5',
  messageImprint: {alg: 'sha256', hash: 'a1a2a3a4...'},
  serial: {'int': 3},
  genTime: {str: '20131231235959.123Z'},
  accuracy: {millis: 500},
  ordering: true,
  nonce: {int: 3}
}
Parameters:
{String} h
hexadecimal string of ASN.1 TSTInfo
Returns:
{Array} JSON object of TSTInfo parameter
See:
KJUR.asn1.tsp.TSTInfo

setTSTInfo(pCMSSignedData)
set ASN.1 TSTInfo parameter to CMS SignedData parameter
This method modifies "econtent.content" of CMS SignedData parameter to parsed TSTInfo.
						
						
					
parser = new KJUR.asn1.tsp.TSPParser();
pCMSSignedData = { 
  ... // almost the same as CMS SignedData parameters
  econtent: {
    type: "tstinfo",
    content: { hex: "30..." }
  },
  ...
};
parser.setTSTInfo(pCMSSignedData);
pCMSSignedData → { 
  ... // almost the same as CMS SignedData parameters
  econtent: {
    type: "tstinfo",
    content: { // TSTInfo parameter
      policy: '1.2.3.4.5',
      messageImprint: {alg: 'sha256', hash: 'a1a2a3a4...'},
      serial: {int: 3},
      genTime: {str: '20131231235959.123Z'},
      accuracy: {millis: 500},
      ordering: true,
      nonce: {int: 3}
    }
  },
  ...
};
Parameters:
{Array} pCMSSignedData
JSON object of CMS SignedData parameter
See:
KJUR.asn1.tsp.TimeStampToken
KJUR.asn1.cms.CMSParser#getCMSSignedData

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