Class UtilsTimestampPdfBc


  • public final class UtilsTimestampPdfBc
    extends java.lang.Object

    Class that contains methods related to the manage of timestamps.

    Project:

    Library for the integration with the services of @Firma, eVisor and TS@.

    Version:
    1.1, 18/04/2022.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Logger LOGGER
      Attribute that represents the object that manages the log of the class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.bouncycastle.tsp.TimeStampToken getFirstTimeStampToken​(org.bouncycastle.asn1.ASN1EncodableVector unsignedAttributes)
      Method that obtains the first time-stamp contained inside of a list of unsigned attributes.
      static java.util.List<org.bouncycastle.tsp.TimeStampToken> getOrderedTimeStampTokens​(org.bouncycastle.asn1.ASN1EncodableVector unsignedAttributes)
      Method that obtains a list with the timestamps contained inside of a set of unsigned attributes.
      static java.security.cert.X509Certificate getSigningCertificate​(org.bouncycastle.tsp.TimeStampToken tst)
      Method that obtain the the signing certificate of a timestamp.
      static org.bouncycastle.tsp.TimeStampToken getTimeStampToken​(org.bouncycastle.asn1.cms.Attribute signatureTimeStampAttribute, java.security.cert.X509Certificate signingCertificate)
      Method that obtains the time-stamp contained inside of a signature-time-stamp attribute.
      static org.bouncycastle.tsp.TimeStampToken getTimeStampToken​(org.bouncycastle.cms.SignerInformation signerInformation)
      Method that obtains the timestamp from the information about a signer of a signature, if it contains a timestamp.
      static void validateASN1Timestamp​(org.bouncycastle.tsp.TimeStampToken tst)
      Method that validates an ASN.1 timestamp.
      static void validateTimestampMessageImprint​(org.bouncycastle.tsp.TimeStampToken tst, byte[] stampedData)
      Method that checks if the value of the messageImprint field within time-stamp token is a hash of the value indicated.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        public static final Logger LOGGER
        Attribute that represents the object that manages the log of the class.
    • Method Detail

      • getSigningCertificate

        public static java.security.cert.X509Certificate getSigningCertificate​(org.bouncycastle.tsp.TimeStampToken tst)
                                                                        throws SigningException
        Method that obtain the the signing certificate of a timestamp.
        Parameters:
        tst - Parameter that represents the timestamp.
        Returns:
        an object that represents the certificate.
        Throws:
        SigningException - If the method fails.
      • validateASN1Timestamp

        public static void validateASN1Timestamp​(org.bouncycastle.tsp.TimeStampToken tst)
                                          throws SigningException
        Method that validates an ASN.1 timestamp.
        Parameters:
        tst - Parameter that represents the ASN.1 timestamp to validate.
        Throws:
        SigningException - If the method fails or the timestamp isn't valid.
      • getTimeStampToken

        public static org.bouncycastle.tsp.TimeStampToken getTimeStampToken​(org.bouncycastle.cms.SignerInformation signerInformation)
                                                                     throws SigningException
        Method that obtains the timestamp from the information about a signer of a signature, if it contains a timestamp.
        Parameters:
        signerInformation - Parameter that represents the information of the signer.
        Returns:
        an object that represents the timestamp, or null.
        Throws:
        SigningException - If the timestamp is malformed.
      • getFirstTimeStampToken

        public static org.bouncycastle.tsp.TimeStampToken getFirstTimeStampToken​(org.bouncycastle.asn1.ASN1EncodableVector unsignedAttributes)
                                                                          throws SigningException
        Method that obtains the first time-stamp contained inside of a list of unsigned attributes.
        Parameters:
        unsignedAttributes - Parameter that represents the list of unsigned attribute of an ASN.1 signature.
        Returns:
        an object that represents the time-stamp.
        Throws:
        SigningException - If one of the attributes contains a badly formed time-stamp.
      • getTimeStampToken

        public static org.bouncycastle.tsp.TimeStampToken getTimeStampToken​(org.bouncycastle.asn1.cms.Attribute signatureTimeStampAttribute,
                                                                            java.security.cert.X509Certificate signingCertificate)
                                                                     throws SigningException
        Method that obtains the time-stamp contained inside of a signature-time-stamp attribute.
        Parameters:
        signatureTimeStampAttribute - Parameter that represents the signature-time-stamp attribute.
        signingCertificate - Parameter that represents the signing certificate.
        Returns:
        an object that represents the time-stamp.
        Throws:
        SigningException - If the time-stamp is badly encoded.
      • validateTimestampMessageImprint

        public static void validateTimestampMessageImprint​(org.bouncycastle.tsp.TimeStampToken tst,
                                                           byte[] stampedData)
                                                    throws SigningException
        Method that checks if the value of the messageImprint field within time-stamp token is a hash of the value indicated.
        Parameters:
        tst - Parameter that represents the timestamp.
        stampedData - Parameter that represents the data stamped to compare with it.
        Throws:
        SigningException - If the validation fails.
      • getOrderedTimeStampTokens

        public static java.util.List<org.bouncycastle.tsp.TimeStampToken> getOrderedTimeStampTokens​(org.bouncycastle.asn1.ASN1EncodableVector unsignedAttributes)
                                                                                             throws SigningException
        Method that obtains a list with the timestamps contained inside of a set of unsigned attributes.
        Parameters:
        unsignedAttributes - Parameter that represents the set of unsigned attributes.
        Returns:
        the list sorted in ascending order.
        Throws:
        SigningException - If the method fails.