Response verification
After receiving the transaction response from the session status API call the following algorithm must be used to decide
-
if the authentication result is trustworthy and what the identity of the authenticating end user is,
-
if the signature result is valid.
In App2App and Web2App flows, the response verification step must be performed after the user has returned via the callback URL, as described in Callback URLs page.
Response verification steps
The following steps perform the response verification algorithm. Note that the algorithm is applicable to both authentication and signature session flows. Specific differences, such as the conditional execution of Steps 1 and 3, are noted within the steps.
-
Session secret verification (applicable only for sessions with flow type
Web2App
orApp2App
):-
Base64 decode the
sessionSecret
string received in the initial request. -
Calculate the SHA-256 digest of the Base64 decoded
sessionSecret
value. -
Encode the raw bytes of the calculated hash using Base64URL.
-
Obtain the
sessionSecretDigest
value from the callback URL parameter visited by the user upon returning to the RP website or application. -
Verify that this Base64URL encoded hash result exactly matches the
sessionSecretDigest
obtained from the callback URL.
-
-
Initial session response check:
-
Verify the
state
field in the JSON response is exactlyCOMPLETE
. -
Verify the
result.endResult
field is exactlyOK
. -
Verify the
signatureProtocol
field is exactlyACSP_V2
in case of authentication orRAW_DIGEST_SIGNATURE
in case of signature. -
Ensure the
cert
,signature
, andresult
objects are present and not null.
-
-
User challenge verification (applicable only for authentication sessions with flow type
Web2App
orApp2App
):-
Obtain the
userChallengeVerifier
value from the callback URL parameter visited by the user upon returning to the RP website or application. -
Calculate the SHA-256 digest of the received
userChallengeVerifier
string. -
Encode the raw bytes of the calculated hash using Base64URL.
-
Verify that this Base64URL encoded hash result exactly matches the
signature.userChallenge
string provided in the JSON response’s signature object.
-
-
Certificate Chain Validation and Trust:
-
Decode the Base64 encoded end-entity certificate string from
cert.value
and parse it into a standard X.509 certificate representation. The RP API provides only the end-entity certificate, the Relying Party must have the necessary root and intermediate CA certificates configured locally to allow the library to build the full certificate chain. For these certificates, see Certificates page. -
Using a standard cryptographic library, initiate the validation of the certificate chain starting from the end-entity certificate. Provide the end-entity certificate to the library, along with configuring it with the set of trusted CA certificates (trust anchors).
-
It’s important to note that some libraries use the system certificate store in addition to the provided CA certificates, this should be disabled and only the explicitly configured CA certificates should be used.
-
-
For each certificate in the constructed chain (end-entity certificate and all intermediate CA certificates), perform the following checks. A standard cryptographic library will typically perform the following checks as part of its overall chain validation routine and report the result as a success or failure.
-
Verify the certificate’s digital signature using the public key of its issuer certificate.
-
Verify the certificate’s validity period against the current time, i.e., not before the
notBefore
date and not after thenotAfter
date. -
Verify that the certificate has not been revoked. This check should be performed using the Online Certificate Status Protocol (OCSP), utilizing the Authority Information Access (AIA) extension within the certificate to locate the OCSP responder URL. If OCSP fails or is unavailable, Certificate Revocation List (CRL) checking should be used as fallback.
-
Note: Revocation checks (OCSP/CRL) are not performed on self-signed root CA certificates configured as trust anchors. Intermediate CA certificates can be revoked and must be checked.
-
Note: OCSP responses are digitally signed. The certificate chain of the OCSP responder itself should also be verified, ensuring it is trusted and authorized to provide status for the certificate being checked.
-
-
Verify basic constraints are appropriate: Intermediate CA certificates must have the Basic Constraints extension present with the
cA
boolean set toTRUE
. For end-entity certificates, the Basic Constraints extension should either absent, or if present, itscA
boolean should be set toFALSE
.
-
-
-
Smart-ID Scheme Identification (End-Entity Certificate):
-
Before checking specific purposes, verify that the end-entity certificate belongs to the Smart-ID scheme.
-
Examine the Certificate Policies extension of the end-entity certificate. The certificate must contain all the specific policy OIDs designated by SK ID Solutions for the Smart-ID scheme (as defined in Chapter 2.2.3 of the "Smart-ID Certificate and OCSP Profile" in Certificate Profiles page). These OIDs differentiate Smart-ID certificates from other types of certificates (e.g., Mobile-ID, Estonian ID-card). The Relying Party must consult the current official SK ID Solutions Certificate Policies for the definitive list of Smart-ID scheme policy OIDs. For these certificate policies, see Certificate Policies page.
-
If not all the recognized Smart-ID scheme policy OIDs are present, the certificate should not be processed as a Smart-ID certificate, and the verification should fail for this context.
-
-
-
End-Entity Certificate Purpose Validation (Smart-ID Context):
-
Examine the end-entity certificate for extensions and attributes required by the certificate profile. For these certificate profiles, see Certificate Profiles page.
-
For Smart-ID authentication: To confirm the certificate is suitable for authentication, it must contain one of the following:
-
The
digitalSignature
key usage and theSmart-ID authentication
(1.3.6.1.4.1.62306.5.7.0
) Extended Key Usage which is present in certificates issued April 2025 onwards. -
The
digitalSignature
,keyEncipherment
,dataEncipherment
key usages and theid-kp-clientAuth
(1.3.6.1.5.5.7.3.2
) Extended Key Usage which is found in older, still valid certificates issued before April 2025.
-
-
For digital signing: Check for appropriate key usage
nonRepudiation
.
-
-
-
Assurance Level Check:
-
Extract the assurance level string from
cert.certificateLevel
(e.g.,ADVANCED
,QUALIFIED
). -
For qualified certificates, check that the extension values as defined by the certificate profile exist within the certificate from
cert.value
. -
Compare this level against the minimum assurance level required by the RP for the specific context or transaction. Ensure the certificate’s level meets or exceeds the required level (note that
ADVANCED < QUALIFIED
).
-
-
Identity Match Check:
-
Extract the authenticated user’s identifier from the end-entity certificate. For Smart-ID certificates
serialNumber
(OID2.5.4.5
) underSubject DN
contain the national identity code, for examplePNOEE-30001010004
. -
If the RP initiated the authentication or signing for a specific known user, verify that the extracted identifier matches the expected identity for that session.
-
-
Verification of
signature
Object (authentication/signature session):-
Only for authentication session: Reconstruct the exact
ACSP_V2_payload
string that was signed, as described underACSP_V2
digest calculation. This is done by concatenating the fields in order, separated by the vertical bar character|
(U+007C):'smart-id'|'ACSP_V2'|serverRandom|rpChallenge|userChallenge|BASE64(relyingPartyName)|BASE64(brokeredRpName)|BASE64(SHA-256(interactions))|interactionTypeUsed|initialCallbackUrl|flowType
-
Only for signature session: Use the data-to-be-signed, a digest of which was initially sent when initiating the signature session (as described in
RAW_DIGEST_SIGNATURE
signature protocol). -
Decode the signature value from
signature.value
using Base64 decoding. -
Obtain the public key from the parsed end-entity user certificate (from Step 4).
-
Only for authentication session: Using a cryptographic library, verify the decoded signature against the UTF-8 bytes of the reconstructed
ACSP_V2_payload
string. -
Only for signature session: Using a cryptographic library, verify the decoded signature against either the data-to-be-signed or the hash of the data-to-be-signed (there are libraries that provide options for either).
-
Ensure the verification uses the algorithm specified in
signature.signatureAlgorithm
(e.g., rsassa-pss) and correctly applies the parameters fromsignature.signatureAlgorithmParameters
(e.g., hash algorithm likeSHA-512
, MGF1 hash likeSHA-512
, salt length like64
, and the trailer field0xbc
).
-
-
Session Management (Only for authentication sessions. Important: only perform if all the preceding steps (1-9) were successful):
-
Invalidate any previous, unauthenticated session identifier associated with the user’s interaction (e.g., browser cookie or API token used before successful authentication).
-
Generate a new, secure, and unique session identifier representing the now authenticated state.
-
Associate the authenticated user’s identity (from Step 8) and potentially the assurance level (from Step 7) with this new session identifier in your server-side session store.
-
-
After a successful action, the users should be able to view their actions or download the signed document. For more information, see Allowing users to verify operations section.