Go crypto/rsa: RSA encryption and signatures
Answer: Package rsa implements RSA encryption as specified in PKCS #1 and RFC 8017.
Encryption and signatures
New designs should use version 2, usually called OAEP and PSS.
The package uses that operation for public-key encryption or public-key signatures.
By default, the terms RSA encryption and RSA signatures refer to PKCS #1 version 1.5.
That older specification has flaws.
Keys and constant-time work
Operations involving private keys use constant-time algorithms in this package.
GenerateKey returns an error if a key of less than 1024 bits is requested.
Such keys are insecure and should not be used.
See also
Claims
- id: C1 claim: Package rsa implements RSA encryption as specified in PKCS #1 and RFC 8017. source: S1 evidence: "Package rsa implements RSA encryption as specified in PKCS #1"
- id: C2 claim: New designs should use version 2, usually called OAEP and PSS. source: S1 evidence: "new designs should use version 2, usually called by just OAEP and PSS"
- id: C3 claim: Operations involving private keys use constant-time algorithms. source: S2 evidence: "Operations involving private keys are implemented using constant-time"
- id: C4 claim: Such keys are insecure and should not be used. source: S2 evidence: "Such keys are insecure and should not be"
Sources
- [S1] crypto/rsa. The Go Authors. https://pkg.go.dev/crypto/rsa . License: BSD-3-Clause. Accessed 2026-11-26.
- [S2] crypto/rsa source. The Go Authors. https://go.dev/src/crypto/rsa/rsa.go . License: BSD-3-Clause. Accessed 2026-11-26.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, crypto/rsa; The Go Authors, crypto/rsa source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, crypto/rsa; The Go Authors, crypto/rsa source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go crypto/rsa: RSA encryption and signatures." iinventedlight Library, iil:note:3aq5dtk2, version of 2026-11-26. https://iinventedlight.com/library/notes/go-rsa/. License: CC-BY-4.0.
@misc{iil_note_3aq5dtk2,
author = {{iinventedlight}},
title = {{Go crypto/rsa: RSA encryption and signatures}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/go-rsa/},
note = {Permanent ID iil:note:3aq5dtk2. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-rsa.schema.json (schema; CC-BY-4.0)
- go-rsa.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-rsa.md.