0

I have a web service that returns a Timestamp Token as a base64 string, I have this code in Java using BouncyCastle to parse, open and extract the date:

String timestamp = "...";

byte[] stamp = Base64.getDecoder().decode(timestamp);

TimeStampToken tst = new TimeStampToken(new CMSSignedData(stamp));

Date fecha = tst.getTimeStampInfo().getGenTime();

System.out.println(fecha);

now I'm trying to do that excatly action but in javascript/typescript, using either JSRSASign or pkijs libraries, those are the ones I have used in digital signature,

but I cant find an example of what I'm trying to do,

I have checked and tried to use the methods exposed by:

  • in pkijs:

    import { TimeStampResp, SignedData } from "pkijs"; but there's not a method to receive a bytearray, I found this in the docs, but again it doesn't start from an already existing token...

  • in jsrsasign:

    KJUR.asn1.cms.CMSUtil the method SignedData() only receives:

    (param?: {
      content: KJUR.asn1.StringParam;
      certs: string[];
      signerInfos: Array<{
          hashAlg: string;
          sAttr: {
              SigningTime: KJUR.asn1.TypeParam | KJUR.asn1.StringParam;
              SigningCertificateV2: KJUR.asn1.ArrayParam<string> | {
                  array: string[];
                  hashalg: string;
              } | KJUR.asn1.cms.SigningCertificateV2;
              SignaturePolicyIdentifier: {
                  oid: string;
                  hash: {
                      alg: string;
                      hash: string;
                  } | KJUR.asn1.cades.SignaturePolicyIdentifier;
              };
          };
          signerCert: string;
          sigAlg: string;
          signerPrvKey: string;
      }>;
    

does anyone has an example of how to parse the base64 or the bytearray, and create a Timestamp Token instance to extract the date as BouncyCastle does?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.