public class Session extends Provider
When signing with this provider, these errors can occur:
PermissionException
: The server did not accept the SSL client certificate or the Claimed Identity string.
PermissionException
: The requested requested distinguished name of the on-demand certificate is not allowed (createSignatureForOnDemandIdentity(java.lang.String, java.lang.String, com.pdftools.crypto.providers.swisscomsigsrv.StepUp)
).
RetryException
: The signing request could not be processed on time by the service.
The service may be overloaded.
IllegalArgumentException
: The key identity of the Claimed Identity string is invalid or not allowed.
HttpException
: If a network error occurs or the service is not operational.
When signing with step-up authorization, these errors can also occur.
PermissionException
: The user canceled the authorization request or failed to enter correct authentication data (password, OTP).
Constructor | Description |
---|---|
Session(java.net.URI url,
HttpClientHandler httpClientHandler) |
Modifier and Type | Method | Description |
---|---|---|
SignatureConfiguration |
createSignatureForOnDemandIdentity(java.lang.String identity,
java.lang.String distinguishedName,
StepUp stepUp) |
Create a signature configuration for an on-demand certificate
|
SignatureConfiguration |
createSignatureForStaticIdentity(java.lang.String identity,
java.lang.String name) |
Create a signature configuration for a static certificate.
|
TimestampConfiguration |
createTimestamp(java.lang.String identity) |
Create a time-stamp configuration
|
equals, hashCode
public Session(java.net.URI url, HttpClientHandler httpClientHandler) throws PermissionException, HttpException
url
- The service endpoint base URL.
Example: https://ais.swisscom.com
httpClientHandler
- The SSL configuration with the client certificate and trust store.
Use pdftools.HttpClientHandler.setClientCertificate
to set your SSL client certificate "clientcert.p12"
of your Swisscom Signing Service account.HttpException
- If a network error occurs.PermissionException
- If the SSL client certificate is rejected.java.lang.IllegalArgumentException
- if url
is null
java.lang.IllegalArgumentException
- if httpClientHandler
is null
public SignatureConfiguration createSignatureForStaticIdentity(java.lang.String identity, java.lang.String name)
identity
-
The Claimed Identity string as provided by Swisscom: \u2039customer name\u203a:\u2039key identity\u203a
Example: "ais-90days-trial:static-saphir4-ch"
name
- Name of the signer. This parameter is not used for certificate selection, but for the signature appearance and signature description in the PDF only.
Example: "Signing Service TEST account"
java.lang.IllegalArgumentException
- if identity
is null
java.lang.IllegalArgumentException
- if name
is null
public SignatureConfiguration createSignatureForOnDemandIdentity(java.lang.String identity, java.lang.String distinguishedName, StepUp stepUp)
identity
-
The Claimed Identity string as provided by Swisscom: \u2039customer name\u203a:\u2039key identity\u203a
Example: "ais-90days-trial:OnDemand-Advanced4"
distinguishedName
- The requested distinguished name of the on-demand certificate.
Example: "cn=Hans Muster,o=ACME,c=CH"
stepUp
- Options for step-up authorization using Mobile ID.java.lang.IllegalArgumentException
- if identity
is null
java.lang.IllegalArgumentException
- if distinguishedName
is null
public TimestampConfiguration createTimestamp(java.lang.String identity)
identity
-
The Claimed Identity string as provided by Swisscom: \u2039customer name\u203a
Example: "ais-90days-trial"
java.lang.IllegalArgumentException
- if identity
is null