.. java:import:: org.json JSONObject .. java:import:: java.io ByteArrayInputStream .. java:import:: java.io ByteArrayOutputStream .. java:import:: java.io IOException .. java:import:: java.io InputStream .. java:import:: java.io OutputStream .. java:import:: java.net HttpURLConnection .. java:import:: java.net Proxy .. java:import:: java.net URL .. java:import:: java.nio.charset StandardCharsets .. java:import:: java.util Map DocumentProcessor ================= .. java:package:: com.idopte.scmapi :noindex: .. java:type:: public class DocumentProcessor Class describes all operations available on a document. Methods ------- signDocument ^^^^^^^^^^^^ .. java:method:: public static void signDocument(InputStream documentStream, PrivateKey privateKey, Certificate certificate, Map options, OutputStream signedDocumentStream) throws SCMException, IOException :outertype: DocumentProcessor Signs a document. The sign options are provided by the ``options`` parameter. It must be a ``Map`` object with the following fields: .. * ``DOCUMENT_SIGNATURE_FORMAT_KEY``: Format to use for signature, given as a string. It can take following value: .. * ``DOCUMENT_SIGNATURE_FORMAT_PKCS7`` for PKCS#7 signature * ``DOCUMENT_HASH_ALGORITHM_KEY``: Hash algorithm to use, given as a string. It can take the following values: .. * ``DOCUMENT_HASH_ALGORITHM_SHA1`` for SHA-1 algorithm * ``DOCUMENT_HASH_ALGORITHM_SHA256`` for SHA-256 algorithm * ``DOCUMENT_HASH_ALGORITHM_SHA384`` for SHA-384 algorithm * ``DOCUMENT_HASH_ALGORITHM_SHA512`` for SHA-512 algorithm Note that this parameter may evolve in the future to handle more options. :param documentStream: The document to sign, given in an ``InputStream`` object. :param privateKey: A \ :java:ref:`PrivateKey`\ object with private attribute, which will be used to sign the document. :param certificate: A \ :java:ref:`Certificate`\ object corresponding to a certificate linked to the current private key, with correct signature usages. :param options: A ``Map`` as described above. :param signedDocumentStream: An ``OutputStream`` where the signed document will be written. :throws SCMException: if an error occurred.