Response verification
This page describes the steps for verifying the details after receiving the transaction response from the session status API call. These steps determine:
-
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 response verification algorithm consists of the following steps. 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
Web2ApporApp2App):-
Base64 decode the
sessionSecretstring received in the initial request. -
Calculate the SHA-256 digest of the Base64 decoded
sessionSecretvalue. -
Encode the raw bytes of the calculated hash using Base64URL.
-
Obtain the
sessionSecretDigestvalue from the callback URL parameters after the user has returned to the RP website or application. -
Verify that this Base64URL encoded hash result exactly matches the
sessionSecretDigestobtained from the callback URL.
-
-
Initial session response check:
-
Verify the
statefield in the JSON response is exactlyCOMPLETE. -
Verify the
result.endResultfield is exactlyOK. -
Verify that the
signatureProtocolfield is exactlyACSP_V2for authentication sessions orRAW_DIGEST_SIGNATUREfor signature sessions. -
Ensure the
cert,signature, andresultobjects are present and not null.
-
-
User challenge verification (applicable only for authentication sessions with flow type
Web2ApporApp2App):-
Obtain the
userChallengeVerifiervalue from the callback URL parameters after the user has returned to the RP website or application. -
Calculate the SHA-256 digest of the received
userChallengeVerifierstring. -
Encode the raw bytes of the calculated hash using Base64URL.
-
Verify that the Base64URL encoded hash result exactly matches the
signature.userChallengevalue in the JSON response’ssignatureobject.
-
-
Certificate Chain Validation and Trust:
-
Decode the Base64 encoded end-entity certificate string from
cert.valueand 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, validate the certificate chain starting from the end-entity certificate. Provide the end-entity certificate to the library and configure the trusted CA certificates as trust anchors.
-
It’s important to note that some libraries use the system certificate store in addition to the explicitly 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
notBeforedate and not after thenotAfterdate. -
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 a 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
cAboolean set toTRUE. For end-entity certificates, the Basic Constraints extension should either absent, or if present, have thecAboolean 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 applicable policy OIDs designated by SK ID Solutions for the Smart-ID scheme (as defined in Chapter 2.2.3 of the "Certificate and OCSP Profile for Smart-ID" 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
digitalSignaturekey 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 onward. -
The
digitalSignature,keyEncipherment,dataEnciphermentkey 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, the
serialNumberattribute (OID2.5.4.5) in theSubject DNcontains the national identity code, for examplePNOEE-30001010004. -
If the RP initiated the authentication or signing for a known user, verify that the extracted identifier matches the identity expected for the session.
-
-
Verification of
signatureObject (authentication/signature session):-
For authentication sessions only: Reconstruct the exact
ACSP_V2_payloadstring that was signed, as described underACSP_V2digest calculation. This is done by concatenating the fields in the specified order and separating them with the vertical bar character|(U+007C):'smart-id'|'ACSP_V2'|serverRandom|rpChallenge|userChallenge|BASE64(relyingPartyName)|BASE64(brokeredRpName)|BASE64(SHA-256(interactions))|interactionTypeUsed|initialCallbackUrl|flowType -
For signature sessions only: Use the data-to-be-signed, a digest of which was initially sent when initiating the signature session (as described in
RAW_DIGEST_SIGNATUREsignature protocol). -
Decode the signature value from
signature.valueusing Base64 decoding. -
Obtain the public key from the parsed end-entity user certificate (from Step 4).
-
For authentication sessions only: Using a cryptographic library, verify the decoded signature against the UTF-8 bytes of the reconstructed
ACSP_V2_payloadstring. -
For signature sessions only: 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, where applicable, the assurance level (from Step 7) with the new session identifier in the server-side session store.
-
-
After a successful action, users should be able to view information about the operation or download the signed document. For more information, see Allowing users to verify operations section.