Replacement of the e-service’s keys in the OIDC interface
The e-service can replace the keys of the OIDC interface without updating the metadata, as long as the public key address jwks_uri) specified in the metadata does not change.
Suomi.fi e-Identification uses the public keys found at this address:
- to verify the signature of an identification request in the request parameter
- to verify the signature of the token request in the client_assertion parameter
- to encrypt the token response in the id_token parameter
Also read the following instructions:
- Metadata in the OIDC interface
- Token request and response in the OIDC interface
The e-service is responsible for the life cycle of its own keys: the creation of new keys, their publication in the jwks_uri address, their deployment and the deletion of old keys. Suomi.fi e-Identification does not specify the practices for replacing the e-service's keys or the key replacement interval.
The e-service should change its keys regularly in accordance with its information security practices, at a minimum, once a year. The replacement practices and intervals are the e-service’s own decision, as long as the caching practices of Suomi.fi e-Identification, described in the following chapter, are considered.
Suomi.fi e-Identification retrieves the public keys of the e-service from the jwks_address and saves them in the cache.
The cache is updated in two ways:
- Timed update. The cache is updated automatically at intervals of 30 minutes.
- As required. If Suomi.fi e-Identification receives a request and the kid value of the key in the request cannot be found in the cache, it will immediately retrieve the public keys of the e-service again from the jwks_uri address.
Impact on replacing the keys:
- Starting to use a new key does not require waiting. When the e-service signs requests with the new key, Suomi.fi e-Identification notices an unknown key and updates the cache.
- The deletion of the old key from the cache of Suomi.fi e-Identification takes place more slowly because there may be a version of the e-service’s public keys that is up to 30 minutes old in the cache. In this case, the deleted key can still be cached, and the token response can be encrypted with the deleted key. You should therefore keep the private key needed for decrypting long enough after deleting it.
The address of the public keys (jwks_uri) must always be available. If the address does not respond when Suomi.fi e-Identification updates its cache (e.g., at the time of the timed update every 30 minutes or because of an unknown key), the result is refusal of the requests if the signature cannot be verified. The availability of the address of public keys (jwks_uri) is therefore a critical part of the functioning of the e-service, and not merely data that is registered once.
The JWKS of the e-service must include the keys for at least the following two purposes (use field):
Intended use | Purpose | Mandatory/optional |
|---|---|---|
Verification of signature (sig) | Verification of the request parameter in the identification request and verification of the signature of the client_assertion parameter in the token request. | Mandatory |
Encryption (enc) | The encryption of the id_token in the token response | Mandatory |
A key valid for encryption is mandatory: The address of the public keys of an e-service (jwks_uri) must always include a key that can be used for encryption. If a key valid for encryption cannot be found in the address of public keys (jwks_uri), token requests will fail completely.
The "alg" and "use" parameters are not mandatory: The alg (algorithm) and use (intended use, sig/enc) fields of the JWK key are not mandatory according to the JWKS definition and Suomi.fi e-Identification does not require them in the address of the e-service’s public keys (jwks_uri). If the use or alg field is missing from the key, Suomi.fi e-Identification may use the key for any purpose compatible with the key type (kty).
The same key for signature and encryption: It is possible to have only one key in the address of the e-service’s public keys (jwks_uri) and it can be used both to sign requests and to encrypt the response. Separate sig and enc keys are therefore not mandatory. However, the key type must be compatible with both of the algorithms specified in the metadata and with the signing algorithm of the identification request. For example, an RSA key is suitable for both RS256 or PS256 signing and for RSA-OAEP-256 encryption. The same RSA key pair can therefore be used for both purposes.
You must check the compatibility of the key type yourself: If the use and alg fields are not indicated, it is not possible to warn automatically in Suomi.fi e-Identification if an attempt is made to use the key with an algorithm that is not suitable for it. It is the e-service’s responsibility to ensure that the type (kty: RSA or EC) of the key published in the address of public keys (jwks_uri) supports the algorithms used both for signing and for encryption, which have been indicated in the e-service’s own metadata. An incompatible key causes the token request to fail.
The e-service can choose freely which key family (RSA or EC) it will use separately for both purposes (sig, enc). The selection is indicated in the metadata of Suomi.fi e-Identification in the corresponding algorithm fields.
Intended use | Field in metadata | RSA algorithms | EC algorithms |
|---|---|---|---|
Allekirjoitus (client_assertion ja request) | kid+alg read from JWT identifier’s header) | RS256, RS512, PS256, PS512 | ES256 |
Salaus (id_token) | id_token_encrypted | RSA-OAEP, RSA-OAEP-256, | ECDH-ES, ECDH- |
More information in the instruction Metadata in the OIDC interface
Example: separate sig and enc keys
In this example, the e-service has selected separate keys: An EC key for signing and an RSA key for encryption.
Example: separate sig and enc keys
{
"keys": [
{
"kty": "EC",
"kid": "rp-sig-2026-09-01",
"use": "sig",
"alg": "ES256",
"crv": "P-256",
"x": "...",
"y": "..."
},
{
"kty": "RSA",
"kid": "rp-enc-2026-09-01",
"use": "enc",
"alg": "RSA-OAEP-256",
"n": "...",
"e": "AQAB"
}
]
}
Example: one key for both purposes
In this example, the e-service uses the same RSA key for both purposes. In this case, the metadata must define the signing algorithm (e.g. RS256) and id_token_encrypted_response_alg (e.g., RSA-OAEP-256) so that both are compatible with the RSA key type. Note that the use and alg fields have not been given.
Example: one key for both purposes
{
"keys": [
{
"kty": "RSA",
"kid": "rp-key-2026-09-01",
"n": "...",
"e": "AQAB"
}
]
}
- The e-service is responsible for the replacement practices and replacement intervals of its own keys.
- Suomi.fi e-Identification updates the public keys of the e-service in its cache (jwks_uri) at intervals of 30 minutes, and as necessary if an unknown key is encountered (kid value cannot be found in the cache.
- The address of the e-service’s public keys (jwks_uri) must always be available and its unavailability prevents identification.
- Public keys must include at least one key that can be used to verify the signature, and one key that can be used for encryption. The same key can be used for both purposes if the key type (kty) supports both of the algorithms specified in the metadata.
- The alg and use fields in the key are optional. If they are not indicated, the e-service is responsible for ensuring the compatibility of the key and the algorithms specified in the metadata.
- The e-service can freely select RSA or EC keys for both purposes in accordance with the algorithms indicated in the metadata.
- The old key (especially the encryption key) must not be removed from use immediately, but must be retained for at least 30 minutes. However, we recommend a longer transition time.