Class Session
- java.lang.Object
-
- com.pdftools.internal.NativeBase
-
- com.pdftools.internal.NativeObject
-
- com.pdftools.crypto.providers.Provider
-
- com.pdftools.crypto.providers.swisscomsigsrv.Session
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class Session extends Provider
The Swisscom Signing Service
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 Summary
Constructors Constructor Description Session(java.net.URI url, HttpClientHandler httpClientHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SignatureConfigurationcreateSignatureForOnDemandIdentity(java.lang.String identity, java.lang.String distinguishedName, StepUp stepUp)Create a signature configuration for an on-demand certificateSignatureConfigurationcreateSignatureForStaticIdentity(java.lang.String identity, java.lang.String name)Create a signature configuration for a static certificate.TimestampConfigurationcreateTimestamp(java.lang.String identity)Create a time-stamp configuration-
Methods inherited from class com.pdftools.internal.NativeObject
equals, hashCode
-
-
-
-
Constructor Detail
-
Session
public Session(java.net.URI url, HttpClientHandler httpClientHandler) throws PermissionException, HttpException- Parameters:
url-The service endpoint base URL.
Example:
https://ais.swisscom.comhttpClientHandler- The SSL configuration with the client certificate and trust store. Usepdftools.HttpClientHandler.setClientCertificateto set your SSL client certificate "clientcert.p12" of your Swisscom Signing Service account.- Throws:
HttpException- If a network error occurs.PermissionException- If the SSL client certificate is rejected.java.lang.IllegalArgumentException- ifurlisnulljava.lang.IllegalArgumentException- ifhttpClientHandlerisnull
-
-
Method Detail
-
createSignatureForStaticIdentity
public SignatureConfiguration createSignatureForStaticIdentity(java.lang.String identity, java.lang.String name)
Create a signature configuration for a static certificate.
- Parameters:
identity-The Claimed Identity string as provided by Swisscom:
‹customer name›:‹key identity›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"- Returns:
- Throws:
java.lang.IllegalArgumentException- ifidentityisnulljava.lang.IllegalArgumentException- ifnameisnull
-
createSignatureForOnDemandIdentity
public SignatureConfiguration createSignatureForOnDemandIdentity(java.lang.String identity, java.lang.String distinguishedName, StepUp stepUp)
Create a signature configuration for an on-demand certificate
- Parameters:
identity-The Claimed Identity string as provided by Swisscom:
‹customer name›:‹key identity›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.- Returns:
- Throws:
java.lang.IllegalArgumentException- ifidentityisnulljava.lang.IllegalArgumentException- ifdistinguishedNameisnull
-
createTimestamp
public TimestampConfiguration createTimestamp(java.lang.String identity)
Create a time-stamp configuration
- Parameters:
identity-The Claimed Identity string as provided by Swisscom:
‹customer name›Example:
"ais-90days-trial"- Returns:
- Throws:
java.lang.IllegalArgumentException- ifidentityisnull
-
-