pdftools_sdk.crypto.providers.swisscom_sig_srv.session

Classes

Session(url, http_client_handler)

The Swisscom Signing Service

class pdftools_sdk.crypto.providers.swisscom_sig_srv.session.Session(url: str, http_client_handler: HttpClientHandler)[source]

Bases: Provider

The Swisscom Signing Service

When signing with this provider, these errors can occur:
  • pdftools_sdk.permission_error.PermissionError: The server did not accept the SSL client certificate or the Claimed Identity string.

  • pdftools_sdk.permission_error.PermissionError: The requested requested distinguished name of the on-demand certificate is not allowed (pdftools_sdk.crypto.providers.swisscom_sig_srv.session.Session.create_signature_for_on_demand_identity).

  • pdftools_sdk.retry_error.RetryError: The signing request could not be processed on time by the service.

The service may be overloaded.
  • ValueError: The key identity of the Claimed Identity string is invalid or not allowed.

  • pdftools_sdk.http_error.HttpError: If a network error occurs or the service is not operational.

When signing with step-up authorization, these errors can also occur.
  • pdftools_sdk.permission_error.PermissionError: The user canceled the authorization request or failed to enter correct authentication data (password, OTP).

__init__(url: str, http_client_handler: HttpClientHandler)[source]
Parameters:
  • url (str) –

    The service endpoint base URL.

    Example: https://ais.swisscom.com

  • httpClientHandler (HttpClientHandler) – The SSL configuration with the client certificate and trust store. Use pdftools_sdk.http_client_handler.HttpClientHandler.set_client_certificate to set your SSL client certificate “clientcert.p12” of your Swisscom Signing Service account.

Raises:
create_signature_for_static_identity(identity: str, name: str) → SignatureConfiguration[source]

Create a signature configuration for a static certificate.

Parameters:
  • identity (str) –

    The Claimed Identity string as provided by Swisscom: ‹customer name›:‹key identity›

    Example: “ais-90days-trial:static-saphir4-ch”

  • name (str) –

    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”

Return type:

SignatureConfiguration

create_signature_for_on_demand_identity(identity: str, distinguished_name: str, step_up: StepUp | None) → SignatureConfiguration[source]

Create a signature configuration for an on-demand certificate

Parameters:
  • identity (str) –

    The Claimed Identity string as provided by Swisscom: ‹customer name›:‹key identity›

    Example: “ais-90days-trial:OnDemand-Advanced4”

  • distinguishedName (str) –

    The requested distinguished name of the on-demand certificate.

    Example: “cn=Hans Muster,o=ACME,c=CH”

  • stepUp (Optional[StepUp]) – Options for step-up authorization using Mobile ID.

Return type:

SignatureConfiguration

create_timestamp(identity: str) → TimestampConfiguration[source]

Create a time-stamp configuration

Parameters:

identity (str) –

The Claimed Identity string as provided by Swisscom: ‹customer name›

Example: “ais-90days-trial”

Return type:

TimestampConfiguration