LogoSignature Service
Remote Signing Service SDK

Appendix

Sequence diagrams

Mobile Gateway - Session establishment sequence diagram

The diagram below describes the session establishment between the SDK and the Mobile Gateway.

Session establishment sequence diagram

Registration sequence diagram

The diagram below describes the enrollment of the SDK and the registration of a DSS profile.

Registration sequence diagram

Signing sequence diagram

The diagram below describes the signing flow when the signing process is initiated from an external SCA and the SDK is used to authenticate the user and unlock the signature.

Signing sequence diagram

DSS Key management

Key specification

256 bits Elliptic Curve (NIST P-256 curve)

Key security

Android

The key is explicitly configured to require user authentication for every use.

This authorization applies only to private key operations. Public key operations are not restricted. It is requested using the system Biometric Prompt with a CryptoObject defining the cryptographic operation to be performed by the operating system.

The key is irreversibly invalidated by the operating system once the secure lock screen of the device is disabled, or when (reconfigured to None, Swipe or other mode which does not authenticate the user) or when the secure lock screen is forcibly reset (e.g., by a Device Administrator), see the KeyGenParameterSpec documentation.

The key is also irreversibly invalided by the operating system on biometric enrollment, or when no more biometrics are enrolled (e.g., when user has removed all registered fingerprints).

The key is explicitly configured to be valid for a duration.

iOS

In RSS iOS 2.6.0, DSS keys are created with kSecAccessControlBiometryCurrentSet | kSecAccessControlPrivateKeyUsage and kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly.

Private-key operations require Face ID or Touch ID. The device passcode must be configured, but it is not a fallback authentication method for using the DSS private key. Retrieving the public key does not require biometric authentication.

The key is bound to the current biometric enrollment and to a device with a passcode. Changes to the biometric enrollment or removal of the passcode invalidate the key. See kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly.

To support batch signing, the SDK calculates a bounded authentication reuse window (TTL) when generating the key, using signing-time measurements and the configured maximum duration. Within this window, it can reuse an authenticated LAContext for private-key operations; after expiry, biometric authentication is requested again. This is authentication-context reuse, not an extension of the key's lifetime.

If authentication or a key operation fails, the SDK reports the error to the application. The application must distinguish cancellation or temporary biometric unavailability from key invalidation, refresh the profile state, and drive reactivation when necessary. The SDK does not automatically present or complete the application's reactivation flow.

Key lifecycle

Generation of the key

A new key pair (private / public keys) is generated every time a new profile is activated.

The key pair is generated in the TEE with an alias corresponding to the dssProfileId prefixed by the username of the user and _ separator. For example, on iOS: UhOb5ZUX21c9KKifNImBvZj8Zd337miNAcyfi35xlwA=_PROFILE-X.

To sign multiple consent tokens, the SDK configures a bounded authentication window based on the estimated time needed for the maximum number of elements at maximum payload size, with a margin and an upper duration limit. On iOS, this controls reuse of the authentication context; it does not expire the key itself.

Android

Once the key is created, we ensure that the key is correctly configured and resides in a secure hardware (Trusted Execution Environment (TEE) or a Secure Element (SE)) using the following KeyInfo methods.

KeyInfo.isInsideSecureHardware(): The key resides in a a TEE or a SE

KeyInfo.isUserAuthenticationRequired(): The key requires a user authentication to be used

KeyInfo.isUserAuthenticationRequirementEnforcedBySecureHardware(): The key requires a user authentication for every cryptographic operation (e.g. no temporal validity interval authorizations)

These checks are required to ensure the device's vendor fulfils the security requirements set by the Android Open Source Project.

iOS

Storage in the TEE is enforced at the key creation specified by Apple's documentation.

Public key operations

The public key is retrieved for every requests with the DSS:

  • Register end user
  • Get pending requests
  • Get consent token
  • Sign consent token

The use of the public key does not require user authentication.

Private key operations

The cryptographic operations with the private key are needed to sign with ECDSA the following DSS requests:

  • Register end user
  • Sign consent token

These operations are performed directly by the TEE. The user has to authenticate to unlock the key. When initializing the cryptographic operation, an error might be raised if the key has been irreversibly invalided by the system.

Key invalidation

The key pair is invalidated in the following cases:

  • The biometric enrollment changes on iOS, or a new biometric is enrolled on Android.
  • The device passcode is removed (iOS).
  • The device's security lock is reset or disabled, or the user has removed all registered biometrics (Android only).
  • During log in, if the application is disenrolled by the security back-end
  • The application is disenrolled by the app (through API)

Once the key pair is invalidated, cryptographic operations are not possible anymore and a new DSS registration is required.

SAP Confirmation code

The confirmation code for a given document signing request is part of the SAP (Signature Activation Protocol) when the document to be signed is displayed, and the DTBS (Data To Be Signed) is generated on a different SCA (Signature Creation Application) device than the SIC (Signer Interaction Component) device.

The confirmation code's purpose is to allow the signer to easily correlate a signature activation request displayed on both the SCA and the SIC.

Specifications

The confirmation code shall be displayed to the signer on the SCA after submitting the DTBSR (Data To Be Signed Representation) to the SSA.

The confirmation code shall not be transmitted between the SCA and the SIC, only a "wake up" mobile push notification containing no transaction-related data should be sent to the SIC in order to initiate the SAP.

The SIC shall fetch the pending signature activation request from the SSA, and display the same confirmation code to the signer.

The confirmation code is derived from the responseID (defined in ETSI TS 119 432, chapter 7.26) on both the SCA and the SIC.

Derivation algorithm

The responseID is generated randomly by the DSS when submitting the DTBS from the SCA. The confirmation code is based on a decimal value derived from this responseID through the following algorithm:

  1. Hash the responseID string's UTF-8 encoded value through SHA-256
  2. Take the first 4 bytes and cast it as an unsigned integer
  3. Use the resulting value modulo 100'000'000

The confirmation code is displayed in two groups of 4 digits, padded with zeros if needed, eg: 1234-5678

Inventory of cryptographic keys

The table below lists all cryptographic keys used by the SDK and its services. The list does not contain keys used exclusively by server modules.

Building blockComponentDescriptionKey detailsGeneration detailsPurposeLifecycleStorage
RSS Mobile SDKSession Service (Mobile Gateway binding & communication)DH key2048 bits Diffie-HellmanKey exchange using Diffie-Hellman, authenticated with shared secret key or activation key. Generated when opening a session on the GWTemporary shared key for session key + shared secret key derivation. On top of https.Lifetime: sessionIn-memory
RSS Mobile SDKSession Service (Mobile Gateway binding & communication)Shared secret key256 bits authentication key, encrypted with a user-supplied password / PIN codeDerived from DH key when renewed. On mobile encrypted with user secret, on database not encrypted by the applicationSHA-256 HMAC authentication of DH key exchange. The key is encrypted when stored using AES 256 with a key derived from a user-supplied password / PIN codeRenewed based on GW configuration. Lifetime: configurable (security server’s admin console). Min value: 1hour in GUI, but can be set to lower value in the databaseiOS: Keychain, Android: KeyStore, GW: database
RSS Mobile SDKSession Service (Mobile Gateway binding & communication)Activation key256 bits authentication keyShort-lived one time use activation code with expiration timestamp, used when activating the SDK. Derived from from randomly generated 16 alphanumeric characters activation codeInitial Shared secret key on SDK activation / GW bindingLifetime: configurable (security server’s admin console). Min value: 1hour in GUI, but can be set to lower value in the database. Deleted once consumed (normally a few milliseconds after having been generated)iOS & Android: In-memory, GW: database
RSS Mobile SDKSession Service (Mobile Gateway binding & communication)Session key256 bits AES/GCM encryption keyDerived from DH key when opening a session. TemporaryData encryption for communication between SDK and gateway (in addition to TLS)Lifecycle bound to session’s lifecycleIn-memory
RSS Mobile SDKSmart Contract serviceSmart Contract messages signing keyRSA 2048 bitsGenerated when activating the SDK through a CSR (Session Service). Generated using mobile devices standard crypto APIs and storageSignature of Smart Contract messages sent to the workflow engineGenerated when activating the SDK through a CSRiOS: Keychain, Android: KeyStore
RSS Mobile SDKDSS Service (SIC)DSS Auth Key for Signature Activation/Consent256 bits Elliptic Curve (NIST P-256 curve) OID 1.2.840.10045.3.1.7. Payload signed using ECDSA with SHA-256 OID 1.2.840.10045.4.3.2Generated when activating the SDK. Generated on mobile protected hardware (TEE), unlocked using biometric authentication (iOS batch signing can reuse an authenticated context within its bounded TTL). To unlock the signing key on the HSMSignature of messages to the DSS for user registration (with EC public key) and consent token, using ECDSALifetime: bound to DSS’ qualified certificate’s lifetime or mobile app installation or user’s signature service registrationHardware protected security module (TEE)

iOS Error Codes

The table below list all available errors that may be raised by the iOS native SDK with Domain ch.sysmosoft.sense.framework.ErrorDomain. The integer error code can be used to identify specifically the type of the error.

Error codeError description
100Account locked
101Device locked
102User disenrolled
104Authentication failed
105Device not compliant
109Network error
110User already enrolled
114Authentication max tries
115User not enrolled
120Not allowed to register notification token
200Request canceled
400Unknown response
401Identification error
403Account locked
404Access Denied
405Application disabled
407Session error
408Request timeout
500Server unreachable
501Missing proxy URL
502Server Error
302No session
303Invalid signature
304Key not found
305Key already exists
306Failed to access to the secure enclave
307Unexpected error

DSS Error mapping

The table below list all available errors that may be raised by the DSS server component. The integer error code can be used to identify specifically the type of the error.

Client error codes

List of error codes that are likely to happen in case of registration synchronisation or signing timeout issues.

Most of code 32 errors (eg. when the application was reinstalled) can be prevented by checking the profile registration status before attempting to register or use a profile.

Some code 39 errors can still happen when a profile was unregistered from the backend or registered from a different device when the registration status was not yet refreshed. In that case, users should be prompted to delete and re-activate the profile.

Code 58 errors may happen in case the of a retry of a signing authentication that succeeded (users must be prevented from submitting the same request twice). Code 59 errors can happen when users take too much time for the biometric authentication. Usually, the user has 90 seconds to authenticate. In both cases, the application should synchronise with server and reload the pending request(s) and/or check for contract status.

Code 60 errors happen when the validation of integrity token against google playintegrity fails.

DSS component version: 3.0.0

Error codeError message
32User already registered with a different authentication key.
39User not registered.
58This digest has already been signed.
59The related signing request has expired.
60Playintegrity validation failed.

Other error codes

With the exception of the client error codes from the previous section, other error codes are likely to be due to a configuration issue or temporary malfunction due to the failure of a backend component.

In that case, users should be prompted to retry a later, with the DSS error code printed in case the error persists and they need to contact the support.

DSS component version: 3.0.0

Error codeError message
1Unknown entity 'MyClass' with UUID '4cfcf5c4-ecb6-493a-9973-4823116aebbd'.
2Remote certificate authentication configured via HTTP header. No certificate found for header attribute 'X-SSL-CERT'.
3Error while decoding certificate.
4No signatory certificate found in certificate list.
5PKCS#10 request does not validate its digital signature.
6Certificate digital signature does not validate.
7No issuer certificate located in chain.
8Certificate with SDN 'CN=John Doe' and S/N '123456789' expired on '20.12.2012'.
9Certificate with SDN ' CN=John Doe ' and S/N '123456789' revoked on '20.12.2012'.
10OSP URL 'https://ocsp.ch' replied with invalid status '42'.
11OSP URL ' https://ocsp.ch' error.
12OSP URL ' https://ocsp.ch' HTTP status code error '42'.
13CRL URL ' https://ocsp.ch' not located.
14CRL encoding error.
15Certificate SDN ' CN=John Doe' not authorized for customer '5bdeee56-dc9f-4f22-ac1e-fd30a50e735f'.
16Error reading signedPayload from HTTP request.
17Error parsing ASN.1 signedPayload.
18Invalid ANS.1 signedPayload.
19No algorithm name resolver for 'MySigningAlgorithm'.
20No Key Factory located.
21Signature does not match.
22Signing certificate not found.
23Too many signing certificates.
24Failed to extract ToBeSigned.
25Baseline not supported '42'.
26Signature format not supported '42'.
27Hexadecimal coder error.
28Unknown algorithm id.
29Cannot log on HSM partition 'DSS-part1'.
30Failed to fetch key 'DSS-part1:key-12345'.
31Failed to initialize key store.
32User already registered with a different authentication key.
33No JWT token.
34JWT token validation failed.
35JWT token is invalid.
36Failed to generate key.
37Failed to encode public key.
38Failed to sign document.
39User not registered.
40Failed to generate CSR.
41Private Key not found in store.
42Failed to fetch key from store.
43Failed to fetch certificate from store.
44Error opening key store.
45Error sending CMC request.
46Error in CMC reply with status code: 42.
47Certificate chain error.
48Could not find signing certificate for user.
49The URL to retrieve JSON Web Key information is invalid.
50DSS has no configured TSA source.
51Customer has no HSM configuration.
52Key is not hardware.
53Maximum number of requests for this transaction reached.
54Cannot find DSS configuration for id 'c3c77821-5033-4486-a741-58484f5df3c2' or default config.
55Error cannot upload twice same transaction (client id '1c37ffc9-b8da-40a1-b1a5-b80cf47daa42').
56numSignatures of the request does not match numSignatures of the transaction.
57Could not find signing transaction with id '6463b5b9-9fce-4459-bc17-52884bbba7a3'.
58This digest has already been signed.
59The related signing request has expired.
60Could not find digest with id '721cfdfc-1c1e-4b31-83cc-20e532186a5d'.
61Failed to generate QR code.
62Unknown customer.
63This customer does not use key protection.
64Template processing error.
65Customer already has ska config.
66Customer not properly initialized.
67Interrupted execution.
68Operation refused. Customer has signatories.
69User not authorized.
70Invalid user role.
71Audit log is not empty.
72Failed to sign audit log.
73No more digest to sign for transaction 'adfa80cf-b8a7-4175-a8c0-e58fb9cd57cc'.
74Access Token Response is not valid.
75Signatory '568d1cfb-6c62-4dfd-85a5-ca8b3b76f10c' credential not valid.
76First audit log entry 'c3822b1b-74ba-4587-a4e9-9e15f34ac681' is not valid.
77Last audit log entry 'e1cf61eb-c074-488a-aa73-d3efaabf5bf5' is not valid.
78Audit log entry '9794112c-e5b8-4508-8b35-31bf3ec54566' has an invalid signature.
79Certificate with SDN 'CN=John Doe' and S/N '6463b5b9' is unknown to the OCSP.
80Audit key '4d9001a9-bef0-4bea-a163-d0d290f52581' is not retired, cannot delete.
81HSM key '4d9001a9-bef0-4bea-a163-d0d290f52581' is not retired, cannot delete.
82Invalid TSA URL.
83Failed to generate a valid timestamp.
84This method is not implemented yet.
85Key encoding error.
86Failed to delete key '4bd3dcd5-1249-4f7f-865d-2924d5d80a9c' from HSM.
87Failed to revoke certificate '123456789'.
88Failed to generate CSR, OID '2.5.4.4' has no suitable mapping.
89Failed to normalize URL with prefix 'foobar'
90Error during UserInfo request: 'Code 00 Description foobar'
91Error during request cancellation: 'adfa80cf-b8a7-4175-a8c0-e58fb9cd57cc'
92Retired PublicKey.
93Error reading oidc mapping: 'foobar'
94Signing transaction with id 'adfa80cf-b8a7-4175-a8c0-e58fb9cd57cc' is partially signed.
95Signing transaction with id 'adfa80cf-b8a7-4175-a8c0-e58fb9cd57cc' is expired.
96Signing transaction with id 'adfa80cf-b8a7-4175-a8c0-e58fb9cd57cc' is incomplete.
97Signing key not found.
98Invalid payload content.
99Failed to create SignatureToken.

On this page