lv.eparaksts.pdf

## Interface PdfSignature

- All Known Subinterfaces:
    PdfBasicSignature, PdfQualifiedSignature

      public interface PdfSignature

  A `PdfSignature` class represents general access methods to the signature object.
  See Also:
    `PdfDocument.addSignature()`, `PdfDocument.addSignature(java.util.Map)`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `KEY_SIGNATURE_METHOD_OID` Configuration propery name for the signature method.
    `static String` | `SIGNATURE_METHOD_ECDSA_SHA256` OID of the "ECDSA-SHA256" signature method.
    `static String` | `SIGNATURE_METHOD_ECDSA_SHA384` OID of the "ECDSA-SHA384" signature method.
    `static String` | `SIGNATURE_METHOD_ECDSA_SHA512` OID of the "ECDSA-SHA512" signature method.
    `static String` | `SIGNATURE_METHOD_RSA_SHA1` OID of the "RSA-SHA1" signature method.
    `static String` | `SIGNATURE_METHOD_RSA_SHA224` OID of the "RSA-SHA224" signature method.
    `static String` | `SIGNATURE_METHOD_RSA_SHA256` OID of the "RSA-SHA256" signature method.
    `static String` | `SIGNATURE_METHOD_RSA_SHA384` OID of the "RSA-SHA384" signature method.
    `static String` | `SIGNATURE_METHOD_RSA_SHA512` OID of the "RSA-SHA512" signature method.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `PdfBasicSignature` | `basicSignature()` Prepares signature for BASIC profile `SignatureProfile.BASIC_SIGNATURE`
    `void` | `complete()` Validates the signature integrity according to the profile requirements.
    `List<byte[]>` | `getCerts()` Returns a list of ASN.1 encoded X509 certificates of the signature.
    `Date` | `getClaimedSigningTime()` Returns claimed signing time of the signature.
    `List<byte[]>` | `getCRLs()` Returns a list of ASN.1 encoded CRL of the signature.
    `byte[]` | `getDocumentTimestamp()` Returns an ASN.1 encoded document timestamp of the signature.
    `String` | `getId()` Returns ID of the signature of the document.
    `String` | `getLocation()` Returns location of the signing.
    `List<byte[]>` | `getOCSPs()` Returns a list of ASN.1 encoded OCSP responses of the signature.
    `SignatureProfile` | `getProfile()` Returns profile of the signature.
    `String` | `getReason()` Returns reason of the signing.
    `String` | `getSignatureMethodAlgorithm()` Returns algorithm OID of the signature method.
    `byte[]` | `getSignatureTimestamp()` Returns an ASN.1 encoded signature timestamp of the signature.
    `byte[]` | `getSignatureValue()` Returns a signature value of the signature.
    `byte[]` | `getSignatureValueDigest(String messageDigestAlgorithm)` Returns hash value of the signature value.
    `X509Certificate` | `getSigningCertificate()` Returns signing certificate of the signature.
    `PdfQualifiedSignature` | `qualifiedSignature()` Prepares signature for QUALIFIED profile `SignatureProfile.QUALIFIED_SIGNATURE`

- - ### Field Detail

    - #### KEY_SIGNATURE_METHOD_OID

          static final String KEY_SIGNATURE_METHOD_OID

      Configuration propery name for the signature method. Property value is OID of the signature method. For example: `1.2.840.113549.1.1.5`
      See Also:
        `PdfDocument.addSignature(java.util.Map)`, Constant Field Values

    - #### SIGNATURE_METHOD_RSA_SHA1

          static final String SIGNATURE_METHOD_RSA_SHA1

      OID of the "RSA-SHA1" signature method.
      See Also:
        Constant Field Values

    - #### SIGNATURE_METHOD_RSA_SHA224

          static final String SIGNATURE_METHOD_RSA_SHA224

      OID of the "RSA-SHA224" signature method.
      See Also:
        Constant Field Values

    - #### SIGNATURE_METHOD_RSA_SHA256

          static final String SIGNATURE_METHOD_RSA_SHA256

      OID of the "RSA-SHA256" signature method.
      See Also:
        Constant Field Values

    - #### SIGNATURE_METHOD_RSA_SHA384

          static final String SIGNATURE_METHOD_RSA_SHA384

      OID of the "RSA-SHA384" signature method.
      See Also:
        Constant Field Values

    - #### SIGNATURE_METHOD_RSA_SHA512

          static final String SIGNATURE_METHOD_RSA_SHA512

      OID of the "RSA-SHA512" signature method.
      See Also:
        Constant Field Values

    - #### SIGNATURE_METHOD_ECDSA_SHA256

          static final String SIGNATURE_METHOD_ECDSA_SHA256

      OID of the "ECDSA-SHA256" signature method.
      See Also:
        Constant Field Values

    - #### SIGNATURE_METHOD_ECDSA_SHA384

          static final String SIGNATURE_METHOD_ECDSA_SHA384

      OID of the "ECDSA-SHA384" signature method.
      See Also:
        Constant Field Values

    - #### SIGNATURE_METHOD_ECDSA_SHA512

          static final String SIGNATURE_METHOD_ECDSA_SHA512

      OID of the "ECDSA-SHA512" signature method.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getId

          String getId()

      Returns ID of the signature of the document. ID is unique in document scope.
      Returns:
        id.

    - #### getProfile

          SignatureProfile getProfile()
                               throws PdfException

      Returns profile of the signature.
      Returns:
        current profile of the signature.
      Throws:
        `PdfException` - if an error occurs.

    - #### getClaimedSigningTime

          Date getClaimedSigningTime()
                              throws PdfException

      Returns claimed signing time of the signature.
      Returns:
        claimed signing time.
      Throws:
        `PdfException` - if an error occurs.

    - #### getLocation

          String getLocation()
                      throws PdfException

      Returns location of the signing.
      Returns:
        location of the signing.
      Throws:
        `PdfException` - if an error occurs.

    - #### getReason

          String getReason()
                    throws PdfException

      Returns reason of the signing.
      Returns:
        reason of the signing.
      Throws:
        `PdfException` - if an error occurs.

    - #### getSignatureTimestamp

          byte[] getSignatureTimestamp()
                                throws PdfException

      Returns an ASN.1 encoded signature timestamp of the signature.
      Returns:
        signature timestamp.
      Throws:
        `PdfException` - if an error occurs.

    - #### getDocumentTimestamp

          byte[] getDocumentTimestamp()
                               throws PdfException

      Returns an ASN.1 encoded document timestamp of the signature.
      Returns:
        document timestamp.
      Throws:
        `PdfException` - if an error occurs.

    - #### getOCSPs

          List<byte[]> getOCSPs()
                         throws PdfException

      Returns a list of ASN.1 encoded OCSP responses of the signature.
      Returns:
        list of encoded OCSP responses included in signature.
      Throws:
        `PdfException` - if an error occurs.

    - #### getCRLs

          List<byte[]> getCRLs()
                        throws PdfException

      Returns a list of ASN.1 encoded CRL of the signature.
      Returns:
        list of encoded CRL objects included in signature.
      Throws:
        `PdfException` - if an error occurs.

    - #### getCerts

          List<byte[]> getCerts()
                         throws PdfException

      Returns a list of ASN.1 encoded X509 certificates of the signature.
      Returns:
        list of encoded X509 certificate objects included in signature.
      Throws:
        `PdfException` - if an error occurs.

    - #### getSignatureValue

          byte[] getSignatureValue()
                            throws PdfException

      Returns a signature value of the signature.
      Returns:
        a signature value.
      Throws:
        `PdfException` - if an error occurs.

    - #### getSigningCertificate

          X509Certificate getSigningCertificate()
                                         throws PdfException

      Returns signing certificate of the signature.
      Returns:
        signing certificate.
      Throws:
        `PdfException` - if an error occurs.

    - #### getSignatureMethodAlgorithm

          String getSignatureMethodAlgorithm()

      Returns algorithm OID of the signature method.
      Returns:
        algorithm OID.

    - #### basicSignature

          PdfBasicSignature basicSignature()
                                    throws PdfException

      Prepares signature for BASIC profile `SignatureProfile.BASIC_SIGNATURE`
      Returns:
        BASIC signature profile interface.
      Throws:
        `PdfException` - if an error occurs.

    - #### qualifiedSignature

          PdfQualifiedSignature qualifiedSignature()
                                            throws PdfException

      Prepares signature for QUALIFIED profile `SignatureProfile.QUALIFIED_SIGNATURE`
      Returns:
        QUALIFIED signature profile interface.
      Throws:
        `PdfException` - if an error occurs.

    - #### complete

          void complete()
                 throws PdfException

      Validates the signature integrity according to the profile requirements.
      Throws:
        `PdfException` - if the signature is not completed.

    - #### getSignatureValueDigest

          byte[] getSignatureValueDigest(String messageDigestAlgorithm)
                                  throws PdfException

      Returns hash value of the signature value. Digest can be used to request Timestamp from Timestamp provider.
      Parameters:
        `messageDigestAlgorithm` - digest algorithm name See the `MessageDigest` section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names. For example: `SHA-1` or `SHA-256`
      Returns:
        digest bytes
      Throws:
        `PdfException` - if no Provider supports a MessageDigestSpi implementation for the specified algorithm

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