Skip to content

Commit b8fdf96

Browse files
committed
docs: add link to NIST docs explaining RSA key size and fix typos
1 parent 9acd33d commit b8fdf96

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

examples/src/keyring/multi/aws_kms_with_escrow.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def run(aws_kms_cmk, source_plaintext):
4949
# Generate an RSA private key to use with your keyring.
5050
# In practice, you should get this key from a secure key management system such as an HSM.
5151
#
52+
# The National Institute of Standards and Technology (NIST) recommends a minimum of 2048-bit keys for RSA.
53+
# https://www.nist.gov/publications/transitioning-use-cryptographic-algorithms-and-key-lengths
54+
#
5255
# Why did we use this public exponent?
5356
# https://crypto.stanford.edu/~dabo/pubs/papers/RSA-survey.pdf
5457
private_key = rsa.generate_private_key(public_exponent=65537, key_size=4096, backend=default_backend())

examples/src/keyring/raw_rsa/private_key_only.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ def run(source_plaintext):
3737
# Generate an RSA private key to use with your keyring.
3838
# In practice, you should get this key from a secure key management system such as an HSM.
3939
#
40+
# The National Institute of Standards and Technology (NIST) recommends a minimum of 2048-bit keys for RSA.
41+
# https://www.nist.gov/publications/transitioning-use-cryptographic-algorithms-and-key-lengths
42+
#
4043
# Why did we use this public exponent?
4144
# https://crypto.stanford.edu/~dabo/pubs/papers/RSA-survey.pdf
4245
private_key = rsa.generate_private_key(public_exponent=65537, key_size=4096, backend=default_backend())

examples/src/keyring/raw_rsa/private_key_only_from_pem.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def run(source_plaintext):
4040
# Generate an RSA private key to use with your keyring.
4141
# In practice, you should get this key from a secure key management system such as an HSM.
4242
#
43+
# The National Institute of Standards and Technology (NIST) recommends a minimum of 2048-bit keys for RSA.
44+
# https://www.nist.gov/publications/transitioning-use-cryptographic-algorithms-and-key-lengths
45+
#
4346
# Why did we use this public exponent?
4447
# https://crypto.stanford.edu/~dabo/pubs/papers/RSA-survey.pdf
4548
private_key = rsa.generate_private_key(public_exponent=65537, key_size=4096, backend=default_backend())

examples/src/keyring/raw_rsa/public_private_key_separate.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
One of the benefits of asymmetric encryption
55
is that you can encrypt with just the public key.
6-
This means that you give someone the ability to encrypt
6+
This means that you can give someone the ability to encrypt
77
without giving them the ability to decrypt.
88
99
The raw RSA keyring supports encrypt-only operations
@@ -47,6 +47,9 @@ def run(source_plaintext):
4747
# Generate an RSA private key to use with your keyring.
4848
# In practice, you should get this key from a secure key management system such as an HSM.
4949
#
50+
# The National Institute of Standards and Technology (NIST) recommends a minimum of 2048-bit keys for RSA.
51+
# https://www.nist.gov/publications/transitioning-use-cryptographic-algorithms-and-key-lengths
52+
#
5053
# Why did we use this public exponent?
5154
# https://crypto.stanford.edu/~dabo/pubs/papers/RSA-survey.pdf
5255
private_key = rsa.generate_private_key(public_exponent=65537, key_size=4096, backend=default_backend())
@@ -103,7 +106,7 @@ def run(source_plaintext):
103106
pass
104107
else:
105108
# Show that the public keyring could not decrypt.
106-
raise AssertionError("This will never happen!")
109+
raise AssertionError("The public key can never decrypt!")
107110

108111
# Decrypt your encrypted data using the decrypt keyring.
109112
#

0 commit comments

Comments
 (0)