Skip to main content
To sign data, send it to Infisical with a Sign/Verify key, and Infisical signs it with the key’s private key. To verify the signature, send it back to Infisical, or give the key’s public key to whoever needs to verify it.

Prerequisites

Signing algorithms

When you sign or verify data, you choose a signing algorithm that matches the key’s algorithm: RSASSA-PSS and ECDSA produce a different signature each time you sign the same data. RSASSA-PKCS1-v1.5 and Ed25519 always produce the same signature for the same data. To list the signing algorithms for a key, call the signing algorithms endpoint.

Sign data

1
In your KMS project, go to Overview, select the options menu on the key’s row, then select Sign Data.
2
Enter your data in Data to Sign, and pick a Signing Algorithm. If your data is already Base64 encoded, turn on Data is Base64 encoded.
3
Select Sign, then copy the signature from Data Signature.

Verify a signature

1
In your KMS project, go to Overview, select the options menu on the row of the key that signed the data, then select Verify Data.
2
Enter the data in Data to Verify and the signature in Signature of Data, then pick the Signing Algorithm that the data was signed with. If your data is already Base64 encoded, turn on Data is Base64 encoded.
3
Select Verify. Signature Status shows Valid if the signature matches the data, and Invalid if it doesn’t.

Sign a digest

If your data is large, or you don’t want to send it to Infisical, you can hash the data yourself and sign the hash (the digest) instead. Digests work only with the RSASSA_PKCS1_V1_5_* and ECDSA_* signing algorithms.
1
Hash your data with the hash function in the signing algorithm’s name, and Base64 encode the result. For example, for RSASSA_PKCS1_V1_5_SHA_512, create a SHA-512 digest:
2
Call the sign endpoint with the digest as data, and add "isDigest": true:
To verify a signature over a digest, send the digest and "isDigest": true to the verify endpoint in the same way.

Publish a public key

If third parties need to verify your signatures without calling Infisical, you can publish a key’s public key at a URL that serves it as a JSON Web Key Set (JWKS), the format that JWT libraries and identity providers read. The URL needs no authentication, so anyone who has it can read the public key. Publishing doesn’t expose the private key. You can publish RSA, ECC, and Ed25519 keys. Publishing a key requires the Admin role, or a custom role with the Modify and Publish Public Key permissions for KMS keys.
1
In your KMS project, go to Overview, select the options menu on the key’s row, then select Publish Public Key.
2
Select the options menu again, select Copy JWKS URL, and give the URL to the third parties that verify your signatures.

Sign tokens with a published key

Each key in the JWKS has a kid, which is the key’s ID followed by its version, such as <key-id>:v1. When you sign a JWT or another token with the key, set the token’s kid header to that value, so verifiers can find the key in the JWKS. To copy the value, select the options menu on the key’s row, then select Copy kid, or read the kid field of the key through the API.
Infisical returns ECDSA signatures DER encoded, but JWTs need them in the raw format, which joins the signature’s r and s values. If you sign JWTs with an ECC key, convert each signature to the raw format before you add it to the token.

Stop publishing a key

To stop publishing a key, select Unpublish Public Key in the key’s options menu, or call the Update key endpoint with isPublicKeyPublished set to false. While a key is unpublished or disabled, its URL returns a 404 error. If a verifier cached the JWKS, it can keep accepting the key’s signatures for a few minutes.