RSA: public keys, encryption schemes and signatures
How RSA fits into encryption and signatures, why raw textbook RSA is insufficient, and what key management and protocol selection require.

On this page
RSA is a public-key cryptographic family named for Rivest, Shamir and Adleman, who described it in 1977. It underpins established encryption and signature schemes. Its security depends on the complete scheme, key generation and implementation—not just on applying modular exponentiation.
Public and private keys
A public key can be distributed; the corresponding private key must be protected. Encryption, signing and verification are distinct operations. A signature is not a general instruction to “encrypt with the private key.”
The basic RSA construction uses a modulus formed from large primes. For two primes p and q, n = p × q. A public exponent e must satisfy the required coprimality condition; the private exponent d is chosen as its multiplicative inverse modulo the appropriate group exponent. The commonly used public exponent 65537 is not a secret.
These are mathematical relationships, not a production key-generation procedure. Use a vetted implementation with an appropriate random source and supported parameters.
A small arithmetic illustration
With the deliberately insecure teaching values n = 3233 and e = 17, the message representative m = 65 produces c = 2790. A corresponding private exponent d = 2753 recovers m = 65. The representative must fit the scheme's constraints; an arbitrary integer larger than n cannot be treated as a reversible message in this example.
Real RSA encryption does not directly exponentiate a word or a complete application payload. It uses a defined encoding and padding scheme. Small textbook values and raw RSA are not suitable for protecting real information.
Encryption and signatures
RSAES-OAEP is an encryption scheme; RSASSA-PSS is a signature scheme. They have different encodings, verification rules and failure behavior. Use the scheme required by a maintained protocol or library rather than inventing padding or treating the schemes as interchangeable.
RSA encryption is limited in message size. Applications commonly use asymmetric mechanisms to establish or protect key material and symmetric authenticated encryption for bulk data. Public keys also require authentication: a mathematically valid key does not prove the owner's identity.
Where RSA fits
Certificates, software signatures and established protocols can use RSA. A website padlock does not reveal that every operation uses RSA, and TLS 1.3 does not use RSA key transport. RSA signatures may still be part of authentication in a protocol that uses a different key-agreement mechanism.
Do not infer a messaging application's construction from the fact that RSA is widely known. Signal, for example, documents a distinct protocol suite; consult its published specifications rather than assuming RSA is its messaging mechanism.
Threats and implementation tradeoffs
Weak randomness, exposed private keys, padding-oracle behavior and side channels can undermine RSA. Larger keys alone do not repair these issues. Use appropriate parameters and libraries that implement the protocol's validation and error-handling requirements.
Quantum threats to RSA differ from those to symmetric encryption or hashing. A sufficiently capable quantum computer could undermine factoring-based public-key cryptography. Increasing an RSA key size is not a general post-quantum migration strategy; follow current standards and the needs of the protocol.
Maintaining a cryptographic system
Plan key protection, certificate renewal, rotation, recovery and algorithm transitions. A technically correct scheme still needs a maintainable operational design.
References
Written by Alex Hovy.
← Back to BlogsContinue reading
Replacing an identity server: ASP.NET Core Identity and OpenIddict
Migration considerations for user management, OAuth/OpenID Connect contracts, credentials and operations, with clear distinctions between identity products.
Authorisation: resource permissions and trusted enforcement
Design understandable access rules, enforce object-level permissions and account for service boundaries, caching and revocation.
Authentication: passwords, MFA, sessions and tokens
Separate identity verification from permissions, and understand the responsibilities around passwords, MFA, sessions, JWT validation and account recovery.