Token certificate setup

Origam uses two certificates to protect authentication tokens from version 2026.9: one for signing token payloads and ID tokens, and one for encrypting access-token, refresh-token, and authorization-code payloads.

Use separate RSA certificates containing their private keys. Self-signed certificates are suitable; these are separate from HTTPS certificates and from the ASP.NET Core Data Protection keys used for cookies and password-reset links. See OpenIddict’s certificate guidance.

All settings below belong to OpenIddictConfig in appsettings.json. Choose either both thumbprints or both file paths; they cannot be combined. If neither is supplied, FallbackGeneratedCertificateDirectory is used when configured.

Keep backups and plan certificate renewal before expiration. Losing or replacing the keys makes existing protected tokens unusable, so users may need to sign in again. Automatic overlapping key rotation is not currently configurable in Origam.

IIS

Recommended: Windows certificate store

Use the Local Computer → Personal certificate store, as recommended by OpenIddict for IIS. Windows manages private-key permissions, and keys can be imported as non-exportable. Origam can use the keys without keeping a PFX file or its password in the application configuration. This makes it more difficult for a potential attacker to steal the certificates.

  1. Prepare signing and encryption PFX files containing their private keys. On Windows, copy Origam’s backend/scripts/create-token-certificates.ps1 to a private working directory and run it there (Windows PowerShell 5.1 with .NET Framework 4.7.2 or later, or PowerShell 7):

    .\create-token-certificates.ps1
    

    This creates two certificates valid for two years and saves signing.pfx, encryption.pfx, signing-password.txt, and encryption-password.txt in the current directory. It does not add certificates to a store; import them separately as described below.

  2. Run certlm.msc as administrator. Right-click Personal → Certificates, choose All Tasks → Import, and import each PFX using its password. Select Personal as the destination. Do not check Mark this key as exportable.

  3. For each imported certificate, choose All Tasks → Manage Private Keys and grant Read access to the application-pool identity, for example IIS AppPool\Origam. If the pool uses a custom account, grant access to that account.

  4. Open each certificate’s Details tab and copy its Thumbprint, removing spaces. Configure:

    {
      "OpenIddictConfig": {
        "SigningCertificateThumbprint": "<signing-thumbprint>",
        "EncryptionCertificateThumbprint": "<encryption-thumbprint>",
        "CertificateStoreLocation": "LocalMachine",
        "CertificateStoreName": "My"
      }
    }
    
  5. Leave both certificate paths unset and restart Origam. Check the Origam.Server.TokenCertificates startup message for the source, thumbprints, and expiration dates.

LocalMachine and My are the defaults; My means Personal. Store loading does not use the certificate-password settings or require the IIS user profile. Keep secure backups of the PFX files and passwords, then remove unnecessary working copies from the server.

Alternative: certificate files

Keep PFX files outside web-served folders and application deployment directories, for example under C:\ProgramData\Origam\MyProject\certificates. Restrict access to administrators and the application identity; Origam only needs read access. Keep certificates and passwords out of source control.

{
  "OpenIddictConfig": {
    "SigningCertificatePath": "C:\\ProgramData\\Origam\\MyProject\\certificates\\signing.pfx",
    "EncryptionCertificatePath": "C:\\ProgramData\\Origam\\MyProject\\certificates\\encryption.pfx"
  }
}

Leave both thumbprints unset. Paths may also be relative to the server’s content root. For password-protected files, supply SigningCertificatePassword and EncryptionCertificatePassword, preferably through deployment secrets or environment variables named OpenIddictConfig__SigningCertificatePassword and OpenIddictConfig__EncryptionCertificatePassword. Not including the passwords in appsettings.json makes it less likely that they will be stolen along with the files should there ever be a security incident. Omit them for passwordless files; file permissions remain essential.

Each restart reloads the same files, so the keys remain unchanged.

Docker

Recommended: externally supplied files

Mount the certificate directory read-only and configure both paths inside the container. This works on Linux and Windows. Origam also supports the Windows certificate store in Windows containers; Linux deployments use files.

For example, mount a host directory at /run/origam-certificates, then set these values in your Docker .env configuration, ensuring they are passed to the container:

OpenIddictConfig__SigningCertificatePath=/run/origam-certificates/signing.pfx
OpenIddictConfig__EncryptionCertificatePath=/run/origam-certificates/encryption.pfx
OpenIddictConfig__SigningCertificatePassword=<signing-password>
OpenIddictConfig__EncryptionCertificatePassword=<encryption-password>

Omit the password entries for passwordless files. On Windows, use the corresponding Windows mount paths. Restrict host-file access and allow the container’s application account to read them. Replicas of the same application must use the same certificate pair.

Automatically generated fallback certificates

When no paths or thumbprints are supplied, Origam’s Docker images use FallbackGeneratedCertificateDirectory: /home/origam/certificates on Linux or C:\home\origam\certificates on Windows. You can override it, for example:

OpenIddictConfig__FallbackGeneratedCertificateDirectory=/run/origam-generated-certificates

Origam reuses signing.pfx and encryption.pfx in this directory. If neither exists, it generates two self-signed RSA certificates valid for two years. Configured certificate passwords are used when generating the files; otherwise the files are passwordless. Runtime generation does not generate passwords. The application needs write access when creating the files.

Files survive a restart of the same container but they will be regenerated if the container is replaced. Existing files are never renewed or overwritten automatically; an incomplete or invalid pair causes startup to fail. Generation and reuse are logged as warnings.

Azure App Service

App Service can deliver certificates as files, so Origam needs no direct Key Vault integration or separate certificate volume for this option. This feature requires Basic tier or higher. See Microsoft’s container certificate documentation.

  1. In your App Service, open Settings → Certificates → Bring your own certificates (.pfx) and add both password-protected PFX files. Alternatively, create exportable RSA certificates in Key Vault and import them into App Service. Set key usage to DigitalSignature for signing and KeyEncipherment for encryption. The free App Service managed HTTPS certificate is not suitable for this purpose.

  2. Add these App Service environment variables, replacing the placeholders with the uploaded certificates’ thumbprints:

    WEBSITE_LOAD_CERTIFICATES=<signing-thumbprint>,<encryption-thumbprint>
    OpenIddictConfig__SigningCertificatePath=/var/ssl/private/<signing-thumbprint>.p12
    OpenIddictConfig__EncryptionCertificatePath=/var/ssl/private/<encryption-thumbprint>.p12
    

    This example is for Linux containers. Windows private files are under C:\appservice\certificates\private; inspect the injected filenames and the WEBSITE_PRIVATE_CERTS_PATH directory. Origam requires complete paths, without environment-variable placeholders. Set Origam’s password entries only if the delivered files require passwords.

  3. Restart the app. Explicit paths bypass fallback generation. After renewal, update the thumbprint-based paths and certificate selection, then restart again.

1 Like