java - Verify RFC 3161 timestamp response with PKIStatus value -


i have soap request, needs redesigned, because soapui can't handle binary responses properly. decided make java based. found this useful, not sure, how functions come on code snippets. have

  • digestvalue
  • signaturevalue
  • x509certificate

defined in soap request , not sure how transform these information send request tsendpint. tried tsaclientbouncycastle too, not sure why need login credentials. left empty fields, finish time

tsaclientbouncycastle@1f0e140b

message.

i call tsaclientbouncycastle class main constructor.

it main part, should decode data.

   // tsa response byte array     inputstream inp = tsaconnection.getinputstream();     bytearrayoutputstream baos = new bytearrayoutputstream();     byte[] buffer = new byte[1024];     int bytesread = 0;     while ((bytesread = inp.read(buffer, 0, buffer.length)) >= 0) {         baos.write(buffer, 0, bytesread);     }     byte[] respbytes = baos.tobytearray();      string encoding = tsaconnection.getcontentencoding();     if (encoding != null && encoding.equalsignorecase("base64")) {         respbytes = base64.decode(new string(respbytes));     } 

a time stamp authority (tsa) generates proof datum existed before particular time. uses protocol , format defined in rfc3161.

a time-stamping response follows (see rfc3161-section 2.4.2):

timestampresp ::= sequence  {   status                  pkistatusinfo,   timestamptoken          timestamptoken     optional  } 

you can parse response of content-type application/timestamp-reply bouncycastle obtain pkistatusinfo

timestampresponse response = new timestampresponse(tsainputstream); int status = response.getstatus(); 

the possible values are

pkistatus ::= integer {   granted                (0),   -- when pkistatus contains value 0 timestamptoken,      requested, present.   grantedwithmods        (1),    -- when pkistatus contains value 1 timestamptoken,      modifications, present.   rejection              (2),   waiting                (3),   revocationwarning      (4),    -- message contains warning revocation    -- imminent   revocationnotification (5)    -- notification revocation has occurred  } 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -