lv.pasts.eme.tsp

## Class TimeStamp

- java.lang.Object
- - lv.pasts.eme.tsp.TimeStamp

-     public final class TimeStamp
      extends Object

  `TimeStamp` class represents the time stamp accordingly to Time Stamp Protocol (RFC 3161).

  An instance of this class can be obtained using request methods from the `TimeStampGenerator` class.

  Since:
    1.3.1

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeStamp(byte[] encoded)` Creates a `TimeStamp` object from the given encoded TimeStampToken value.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getCanonicalizationMethod()` Applies only for XAdES timestamps.
    `byte[]` | `getEncoded()` Returns an ASN.1 encoded TimeStampToken value.
    `Date` | `getGenTime()` Returns time when this TimeStamp was created.
    `String` | `getMessageImprintAlgOID()`
    `byte[]` | `getMessageImprintDigest()` Returns a message digest contained by this TimeStamp.
    `BigInteger` | `getSerialNumber()` Returns the serial number of this TimeStamp.
    `X509Certificate` | `getSigningCertificate()` Returns TSA certificate used to sign this TimeStamp.
    `void` | `setCanonicalizationMethod(String canonicalizationMethod)`
    `void` | `validateSignature(PublicKey publicKey)` Validates TimeStamp signature using the given PublicKey.
    `X509Certificate` | `validateSigningCertificate()` Deprecated. method is obsolete as of the version 2.2.0, no replacement.
    `X509Certificate` | `validateSigningCertificate(boolean checkCRLs)` Deprecated. method is obsolete as of the version 2.2.0, no replacement.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TimeStamp

          public TimeStamp(byte[] encoded)
                    throws TSPException

      Creates a `TimeStamp` object from the given encoded TimeStampToken value.
      Parameters:
        `encoded` - an array of bytes containing an ASN.1 encoded TimeStampToken value.
      Throws:
        `TSPException` - if the TimeStamp cannot be created.

  - ### Method Detail

    - #### getEncoded

          public byte[] getEncoded()
                            throws TSPException

      Returns an ASN.1 encoded TimeStampToken value.
      Returns:
        an array of bytes containing an ASN.1 encoded TimeStampToken value.
      Throws:
        `TSPException` - if the encoded value cannot be extracted.

    - #### getMessageImprintDigest

          public byte[] getMessageImprintDigest()

      Returns a message digest contained by this TimeStamp.
      Returns:
        an array of bytes containing a message digest.

    - #### getSigningCertificate

          public X509Certificate getSigningCertificate()
                                                throws TSPException

      Returns TSA certificate used to sign this TimeStamp.
      Returns:
        TSA certificate used to sign this TimeStamp, or `null` if the certificate is not included.
      Throws:
        `TSPException` - if the certificate cannot be extracted.

    - #### getGenTime

          public Date getGenTime()

      Returns time when this TimeStamp was created.
      Returns:
        time when this TimeStamp was created.

    - #### getSerialNumber

          public BigInteger getSerialNumber()

      Returns the serial number of this TimeStamp.

      Time-Stamping users MUST be ready to accommodate integers up to 160 bits, as defined in IETF RFC 3161 Time-Stamp Protocol (TSP).

      Returns:
        the serial number.

    - #### getMessageImprintAlgOID

          public String getMessageImprintAlgOID()

    - #### validateSigningCertificate

          @Deprecated
          public X509Certificate validateSigningCertificate()
                                                                  throws TSPException

      Deprecated. method is obsolete as of the version 2.2.0, no replacement.
      Validates TSA certificate used to sign this TimeStamp.

      TSA certificate is validated performing the following checks:

      - check if certificate is included in this TimeStamp;
      - check if certificate chain is trusted using `TrustStore.generateCertPath(X509Certificate)`;
      - check if certificate chain is valid at the TimeStamp generation time;
      - check if certificate is not revoked using CRL data `CRLManager.getCRLs(X509Certificate)`.
      Returns:
        the validated TSA certificate.
      Throws:
        `TSPException` - if one of the TSA certificate checks fail or cannot be performed.
      Since:
        1.4.0

    - #### validateSigningCertificate

          @Deprecated
          public X509Certificate validateSigningCertificate(boolean checkCRLs)
                                                                  throws TSPException

      Deprecated. method is obsolete as of the version 2.2.0, no replacement.
      Validates TSA certificate used to sign this TimeStamp.
      Parameters:
        `checkCRLs` - true if to perform the CRL revocation check.
      Returns:
        the validated TSA certificate.
      Throws:
        `TSPException` - if one of the TSA certificate checks fail or cannot be performed.
      Since:
        1.4.2
      See Also:
        `validateSigningCertificate()`

    - #### validateSignature

          public void validateSignature(PublicKey publicKey)
                                 throws TSPException

      Validates TimeStamp signature using the given PublicKey.
      Parameters:
        `publicKey` - the PublicKey to use for signature validation.
      Throws:
        `TSPException` - if TimeStamp signature cannot be verified.
      Since:
        1.4.0

    - #### getCanonicalizationMethod

          public String getCanonicalizationMethod()

      Applies only for XAdES timestamps.
      Returns:
        `String` representing the canonicalization method used by the timestamp, or `null` if unspecified.

    - #### setCanonicalizationMethod

          public void setCanonicalizationMethod(String canonicalizationMethod)

Copyright VAS Latvijas Valsts radio un televizijas centrs / Developed by SIA EUSO