DocumentProcessor¶
- public class DocumentProcessor¶
Class describes all operations available on a document.
Methods¶
signDocument¶
- public static void signDocument(InputStream documentStream, PrivateKey privateKey, Certificate certificate, Map<String, Object> options, OutputStream signedDocumentStream)¶
Signs a document. The sign options are provided by the
optionsparameter. It must be aMapobject 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_PKCS7for PKCS#7 signature
DOCUMENT_HASH_ALGORITHM_KEY: Hash algorithm to use, given as a string. It can take the following values:DOCUMENT_HASH_ALGORITHM_SHA1for SHA-1 algorithmDOCUMENT_HASH_ALGORITHM_SHA256for SHA-256 algorithmDOCUMENT_HASH_ALGORITHM_SHA384for SHA-384 algorithmDOCUMENT_HASH_ALGORITHM_SHA512for SHA-512 algorithm
Note that this parameter may evolve in the future to handle more options.
- Parameters:
documentStream – The document to sign, given in an
InputStreamobject.privateKey – A
PrivateKeyobject with private attribute, which will be used to sign the document.certificate – A
Certificateobject corresponding to a certificate linked to the current private key, with correct signature usages.options – A
Mapas described above.signedDocumentStream – An
OutputStreamwhere the signed document will be written.
- Throws:
SCMException– if an error occurred.