lv.eparaksts.helpers

## Class EDoc2Batch

- java.lang.Object
- - lv.eparaksts.helpers.EDoc2Batch

-     public class EDoc2Batch
      extends Object

  `EDoc2Batch` class provides functionality to process multiple `EDOC 2.0` documents in a single batch job.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes this batch job and releases associated system resources.
    `List<EDoc2BatchResult>` | `complete()` Completes the signature by adding the required revocation values.
    `List<EDoc2BatchResult>` | `complete(boolean useTrustedList)` Completes the signature by adding the required revocation values.
    `static EDoc2Batch` | `fromFiles(File[] files)` Prepare a new batch job from the given files.
    `static EDoc2Batch` | `fromFiles(File[] files, boolean openAsEDoc)` Prepare a new batch job from the given files.
    `Map<String,byte[]>` | `getSignableBytes()` Returns signable bytes.
    `Map<String,byte[]>` | `getSignableBytes(Map<String,String> properties)` Returns signable bytes with specified properties.
    `Map<String,String>` | `getSignatureMethodAlgorithm()` Returns algorithm name of the signature method.
    `Map<String,byte[]>` | `getSignatureValueDigest(String messageDigestAlgorithm)` Returns hash value of the signature value.
    `void` | `setSignatureProductionPlace(SignatureProductionPlace signatureProductionPlace)` Sets claimed signature production location.
    `void` | `setSignatureTimestamps(Map<String,List<byte[]>> signatureTimestampsMap)` Sets a list of ASN.1 encoded signature timestamps to the signature.
    `void` | `setSignatureTimestamps(String messageDigestAlgorithm, KeyAccessor keyAccessor)` Requests and sets signature timestamps to the signature.
    `void` | `setSignatureValue(Map<String,byte[]> signatureValueMap)` Sets a signature value to the signature.
    `void` | `setSignerClaimedRoles(List<String> signerClaimedRoles)` Sets claimed signer roles for the signature.
    `void` | `setSigningCertificate(X509Certificate certificate)` Sets signing certificate for the signature.

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

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

- - ### Method Detail

    - #### fromFiles

          public static EDoc2Batch fromFiles(File[] files)
                                      throws EDoc2Exception

      Prepare a new batch job from the given files.
      Parameters:
        `files` - files to process.
      Returns:
        the prepared batch job.
      Throws:
        `EDoc2Exception` - if an error occurs.

    - #### fromFiles

          public static EDoc2Batch fromFiles(File[] files,
                                             boolean openAsEDoc)
                                      throws EDoc2Exception

      Prepare a new batch job from the given files.
      Parameters:
        `files` - files files to process.
        `openAsEDoc` - true if the given files are EDOC documents.
      Returns:
        the prepared batch job.
      Throws:
        `EDoc2Exception` - if an error occurs.

    - #### setSigningCertificate

          public void setSigningCertificate(X509Certificate certificate)

      Sets signing certificate for the signature.
      Parameters:
        `certificate` - signing certificate.

    - #### setSignerClaimedRoles

          public void setSignerClaimedRoles(List<String> signerClaimedRoles)

      Sets claimed signer roles for the signature.
      Parameters:
        `signerClaimedRoles` - a list of claimed roles.

    - #### setSignatureProductionPlace

          public void setSignatureProductionPlace(SignatureProductionPlace signatureProductionPlace)

      Sets claimed signature production location.
      Parameters:
        `signatureProductionPlace` -

    - #### getSignableBytes

          public Map<String,byte[]> getSignableBytes()
                                              throws EDoc2Exception

      Returns signable bytes. Signable bytes is hash that is calculated using signature method algorithm.
      Returns:
        a map containing signable bytes for each of the input files.
      Throws:
        `EDoc2Exception` - if an error occurs.
      See Also:
        `setSignatureValue(Map)`

    - #### getSignableBytes

          public Map<String,byte[]> getSignableBytes(Map<String,String> properties)
                                              throws EDoc2Exception

      Returns signable bytes with specified properties. Signable bytes is hash that is calculated using signature method algorithm.
      Parameters:
        `properties` -
      Returns:
        a map containing signable bytes for each of the input files.
      Throws:
        `EDoc2Exception` - if an error occurs.
      See Also:
        `setSignatureValue(Map)`, `EDoc2Signature.KEY_SIGNATURE_METHOD_URI`

    - #### getSignatureMethodAlgorithm

          public Map<String,String> getSignatureMethodAlgorithm()
                                                         throws EDoc2Exception

      Returns algorithm name of the signature method.
      Returns:
        a map containing algorithm name of the signature method for each of the input files.
      Throws:
        `EDoc2Exception` - if an error occurs.
      See Also:
        `getSignableBytes()`, `getSignableBytes(Map)`

    - #### setSignatureValue

          public void setSignatureValue(Map<String,byte[]> signatureValueMap)
                                 throws EDoc2Exception

      Sets a signature value to the signature. Signature value can be calculated from signable bytes.
      Parameters:
        `signatureValueMap` - a map containing signature value bytes for each of the input files.
      Throws:
        `EDoc2Exception` - if an error occurs.
      See Also:
        `getSignableBytes()`, `getSignableBytes(Map)`

    - #### getSignatureValueDigest

          public Map<String,byte[]> getSignatureValueDigest(String messageDigestAlgorithm)
                                                     throws EDoc2Exception

      Returns hash value of the signature value. Digest can be used to request Timestamp from Timestamp provider.
      Parameters:
        `messageDigestAlgorithm` - signature value digest algorithm name.
      Returns:
        a map containing signature value digest bytes for each of the input file signatures.
      Throws:
        `EDoc2Exception` - if an error occurs.
      See Also:
        `setSignatureTimestamps(Map)`

    - #### setSignatureTimestamps

          public void setSignatureTimestamps(Map<String,List<byte[]>> signatureTimestampsMap)
                                      throws EDoc2Exception

      Sets a list of ASN.1 encoded signature timestamps to the signature.
      Parameters:
        `signatureTimestampsMap` - a map containing timestamp bytes for each of the input file signatures.
      Throws:
        `EDoc2Exception` - if an error occurs.
      See Also:
        `getSignatureValueDigest(String)`

    - #### setSignatureTimestamps

          public void setSignatureTimestamps(String messageDigestAlgorithm,
                                             KeyAccessor keyAccessor)
                                      throws EDoc2Exception

      Requests and sets signature timestamps to the signature.
      Parameters:
        `messageDigestAlgorithm` - signature value digest algorithm name.
        `keyAccessor` - a `KeyAccessor` instance used to select a certificate required for TSA client authentication.
      Throws:
        `EDoc2Exception` - if an error occurs.

    - #### complete

          public List<EDoc2BatchResult> complete()
                                          throws EDoc2Exception

      Completes the signature by adding the required revocation values.
      Returns:
        a list containing the resulting EDOC documents.
      Throws:
        `EDoc2Exception` - if an error occurs.
      See Also:
        `close()`

    - #### complete

          public List<EDoc2BatchResult> complete(boolean useTrustedList)
                                          throws EDoc2Exception

      Completes the signature by adding the required revocation values.
      Parameters:
        `useTrustedList` - whether to use EU Trusted Status List data.
      Returns:
        a list containing the resulting EDOC documents.
      Throws:
        `EDoc2Exception` - if an error occurs.

    - #### close

          public void close()

      Closes this batch job and releases associated system resources.

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