public class CadesSignatureStarter extends SignatureStarter
Note on confidentiality: the file to be signed is stored on the server between the first and second steps, but never unencrypted. The content is encrypted using AES-128 and the key is not stored on the server, it is instead mixed into the token that is returned and which is necessary on the second step. In other words, the server stores the file but is unable to read it on its own, therefore the file contents cannot be compromised, even in the event of a complete data leakage.
callbackArgument, certificate, certificateInfo, client, done, securityContextId, signaturePolicyId
Constructor and Description |
---|
CadesSignatureStarter(RestPkiClient client)
Create a new instance using the given RestPkiClient.
|
Modifier and Type | Method and Description |
---|---|
void |
setCmsToCoSign(byte[] cmsToCoSign)
Sets the CMS to be co-signed as a byte array
|
void |
setCmsToCoSign(java.io.InputStream stream)
Sets the CMS to be co-signed
|
void |
setCmsToCoSign(java.nio.file.Path path)
Sets the path of the CMS file to be co-signed
|
void |
setCmsToCoSign(java.lang.String path)
Sets the path of the CMS file to be co-signed
|
void |
setContentToSign(byte[] content)
Sets the content to be signed as a byte array
|
void |
setContentToSign(java.io.InputStream stream)
Sets the content to be signed
|
void |
setEncapsulateContent(java.lang.Boolean encapsulateContent)
Optionally denotes whether the resulting CMS should include the content signed.
|
void |
setFileToSign(java.nio.file.Path path)
Sets the path of the file to be signed
|
void |
setFileToSign(java.lang.String path)
Sets the path of the file to be signed
|
ClientSideSignatureInstructions |
start()
Performs the first step, should be called after setting the necessary parameters.
|
java.lang.String |
startWithWebPki()
Performs the first step, should be called after setting the necessary parameters.
|
getCertificateInfo, setCallbackArgument, setSecurityContext, setSignaturePolicy, setSignerCertificate
public CadesSignatureStarter(RestPkiClient client)
client
- the RestPkiClient which shall be used.public void setContentToSign(java.io.InputStream stream) throws java.io.IOException
stream
- a pre-opened InputStream linked to the file that will be signed. The stream is NOT closed by this method.java.io.IOException
- if an error occurs while reading the stream.public void setContentToSign(byte[] content)
content
- Binary content to be signedpublic void setFileToSign(java.lang.String path) throws java.io.IOException
path
- Path of the file to be signed.java.io.IOException
- if an error occurs while reading the file.public void setFileToSign(java.nio.file.Path path) throws java.io.IOException
path
- Path of the file to be signed.java.io.IOException
- if an error occurs while reading the file.public void setCmsToCoSign(java.io.InputStream stream) throws java.io.IOException
stream
- a pre-opened InputStream linked to the CMS file that will be co-signed. The stream is NOT closed by
this method.java.io.IOException
- if an error occurs while reading the stream.public void setCmsToCoSign(byte[] cmsToCoSign)
cmsToCoSign
- Binary content of the CMS to be co-signedpublic void setCmsToCoSign(java.lang.String path) throws java.io.IOException
path
- Path of the CMS file to be co-signed.java.io.IOException
- if an error occurs while reading the file.public void setCmsToCoSign(java.nio.file.Path path) throws java.io.IOException
path
- Path of the CMS file to be co-signed.java.io.IOException
- if an error occurs while reading the file.public void setEncapsulateContent(java.lang.Boolean encapsulateContent)
If no CmsToSign is given, the resulting CMS will include the content
If a CmsToCoSign is given, the resulting CMS will include the content if and only if the CmsToCoSign also includes the content
public ClientSideSignatureInstructions start() throws RestException
SignatureStarter
start
in class SignatureStarter
RestException
- if an error occurs when calling REST PKIpublic java.lang.String startWithWebPki() throws RestException
SignatureStarter
startWithWebPki
in class SignatureStarter
RestException
- if an error occurs when calling REST PKI