Login
  • Intro to IAM
  • What Is an RSA Key? Understanding Asymmetric Pairs

What Is an RSA Key? Understanding Asymmetric Pairs

When an application receives a token, it needs to answer a basic question: Can I trust this? The app must know whether the token came from the expected issuer and whether anyone changed it after it was issued.

RSA keys help make that possible. Rivest-Shamir-Adleman (RSA) is a public-key cryptography algorithm that uses a pair of related keys: one private and one public. In token-based systems, the issuer can sign a token with a private key, and applications can verify that signature with a public key.

For developers and platform teams building customer-facing applications, token signature verification helps APIs trust identity data without sharing signing secrets across every service. This article explains what is an RSA key, how public and private keys work together, what a JSON Web Key Set endpoint does, and why token signatures matter for secure application architecture.

Key Takeaways

  • What is an RSA key: A cryptographic key used in an asymmetric public/private key pair
  • Private keys must stay protected because they can sign trusted data
  • Public keys can be shared so applications can verify signatures
  • JSON Web Key Set endpoints publish public keys that applications use to verify signed tokens
  • Auth0 Token Signatures help applications verify that tokens were issued by a trusted identity provider
  • Correct token signature verification helps protect customer trust across APIs and distributed services

What is an RSA key?

An RSA key is a cryptographic key used with the RSA algorithm. RSA uses asymmetric cryptography, which means the system uses a pair of mathematically related keys instead of one shared secret.

The key pair includes:

  • A private key that must remain secret
  • A public key that can be shared

In identity systems, RSA keys are often used to sign and verify JSON Web Tokens (JWTs). The identity provider signs a token with the private key. The application verifies that token with the corresponding public key.

How do public and private keys work together?

Public and private keys have different jobs.

The private key is controlled by the issuer. It should never be exposed to applications, users, or public repositories. If an attacker gets the private key, they may be able to sign data that appears trusted.

The public key is distributed to systems that need to verify signatures. It does not need to remain secret. Applications use it to confirm that signed data came from the holder of the private key.

This model helps avoid sharing one secret across every app and API. Instead, the issuer protects the private key, and other systems use public keys for verification.

How do RSA keys sign tokens?

Token signing helps applications detect tampering and verify trust.

A typical signing flow looks like this:

  • An identity provider creates a token
  • The provider signs the token with its private key
  • The application receives the token
  • The application retrieves the matching public key
  • The application verifies the signature
  • The application checks issuer, audience, expiration, and other claims
  • The application accepts or rejects the token

If the token changes after it is signed, signature verification should fail. If the token was signed by an unknown key, verification should fail. This is why correct validation matters as much as the signing process itself.

What is a JWKS endpoint?

A JSON Web Key Set (JWKS) endpoint publishes public keys in a standard format. Applications use the JWKS endpoint to retrieve the keys needed to verify signed JSON web tokens (JWTs).

A JWKS endpoint is especially useful because signing keys may rotate. Instead of hardcoding a key forever, applications can fetch current public keys and use the key ID in the token header to choose the right key.

This helps support:

  • Token signature verification
  • Key rotation
  • Multiple active signing keys
  • Standardized public key distribution
  • Safer validation across applications and APIs

Developers should use reliable JWT libraries that can retrieve, cache, and refresh JWKS data safely.

How are RSA keys used in application security?

RSA keys show up in several application security workflows, especially when systems need trust without sharing the same secret everywhere.

Use caseHow RSA keys helpWhy platform teams care
JWT verificationApplications verify that signed tokens came from the expected issuerAPIs can reject forged or tampered tokens
Signing key rotationPublic keys can be updated through a JWKS endpoint without sharing private keysTeams can rotate keys with less application disruption
Distributed API validationMultiple APIs can verify tokens using public keysMicroservices can validate identity context consistently
Tamper detectionSignature verification fails if signed data changesApplications can avoid trusting modified token claims
Trust separationThe issuer protects the private key while applications use public keysTeams avoid sharing signing secrets across every service

For developers, the practical takeaway is simple: don’t just decode tokens. Verify them with the right key and validation rules.

How do RSA keys compare with shared secrets?

RSA key pairs are different from symmetric shared secrets. In symmetric cryptography, the same secret is used to sign and verify. In asymmetric cryptography, the private key signs and the public key verifies.

Comparison pointRSA key pairShared secret
Key modelUses separate private and public keysUses the same secret for signing and verification
VerificationPublic key can verify signaturesVerifier must know the shared secret
DistributionPublic key can be widely sharedSecret must be tightly protected everywhere it is used
Common token algorithm familyRS256 and related asymmetric algorithmsHS256 and related symmetric algorithms
Operational fitGood for distributed verificationUseful for simpler trusted-server scenarios

For many API ecosystems, asymmetric signing is useful because multiple services can verify tokens without all sharing a signing secret.

What are RSA key security best practices?

RSA keys are security-critical. Treat them as part of your identity infrastructure.

Best practiceWhy it matters
Protect private keysPrivate keys can sign trusted data and must remain secret
Use trusted librariesCustom cryptography code is easy to get wrong
Validate algorithmsApplications should reject unexpected or insecure algorithms
Check issuer and audienceA valid signature alone is not enough
Support key rotationSigning keys should be replaceable without breaking validation
Cache JWKS safelyBalance performance with key freshness
Monitor verification failuresFailures may indicate misconfiguration or attack attempts

Developers should not treat token verification as a one-line decode step. A decoded token is not the same as a validated token.

How do Auth0 Token Signatures support secure verification?

Auth0 Token Signatures help applications verify that tokens were issued by Auth0 and were not forged or altered. Auth0 publishes public signing keys through a JWKS endpoint so applications and APIs can validate token signatures using trusted keys.

For enterprise and API-driven teams, that supports a more consistent trust model across distributed applications and customer-facing services.

If your team is building token validation into apps and APIs, contact Auth0 to discuss how Auth0 can support secure identity architecture.

Frequently Asked Questions

What is an RSA key pair?

An RSA key pair includes a private key and a public key. The private key signs or decrypts data, while the public key verifies signatures or encrypts data, depending on the use case.

How do public and private keys work together to sign data?

The issuer signs data with the private key. Other systems use the public key to verify that the signature is valid and that the data has not changed.

How do I set up a JWKS endpoint to get public keys to verify tokens?

Use the JWKS endpoint provided by your identity provider. Configure your application or API to retrieve public keys, cache them safely, and select the correct key based on the token’s key ID.

Why does token signature verification matter?

Signature verification helps confirm that a token came from a trusted issuer and was not modified. Without verification, an application may trust forged or tampered data.

Take the Next Step in Identity Management

Using a service like Auth0 can simplify the implementation of both authentication and authorization, allowing developers to concentrate on their core application logic. Explore our Intro to IAM series for additional topics related to identity and access management.

Learn more

These materials are intended for general informational purposes only. You are responsible for obtaining security, privacy, compliance, or business advice from your own professional advisors and should not rely solely on the information provided herein.

Start building for free