Public key and secret storage

Learn about public key, private key, and secret in JSON Web Token (JWT). Also learn about JSON Web Key (JWK), keystore, and property which Schema Registry supports for storing the public key or the secret.

When JWTs are signed with RSA, then you have a private and public key pair. The private key is located on the OAuth2 server and is hidden from you. Schema Registry uses the public key for validating the signature of the JWT token.

When JWTs are signed with HMAC, then you have a secret which is shared by all parties. The secret is used for signing the token and also for verifying it.

Schema Registry supports the following ways to store the public key or the secret:
  • JWK

    JSON Web Key is a data structure that describes a key. When you have multiple keys collected in a set, that data structure is named JWKS. A JWKS basically contains a collection of keys.

    Usually there is a public web service which exposes the JWKS. You can obtain the JWKS through an HTTP request. Other transportation methods are possible, for example, the keys can be stored in a file or on a network storage.

    The keys are usually short lived (depending on the provider, they last from one day to one week). For this reason Schema Registry runs a thread every 5 minutes to refresh the keys. The interval can be customized.

  • Keystore

    The keys can be stored in a Java keystore file. You need to ensure that Schema Registry has access to the file and permission to read the key.

  • Property

    The public key or secret can be stored directly in Schema Registry. In this case, you enter the key in Cloudera Manager and Schema Registry loads it during startup. This option is useful when the public key expires rarely and you do not want to depend on an external JWK service for managing the keys.