Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#12095 Increase RSA keys generated in tests #12095

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/twisted/conch/test/test_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,8 @@ def test_providedArguments(self):
tempDir = FilePath(self.mktemp())
keyFile = tempDir.child("mykey.pem")

key = keys._getPersistentRSAKey(keyFile, keySize=512)
self.assertEqual(key.size(), 512)
key = keys._getPersistentRSAKey(keyFile, keySize=1024)
self.assertEqual(key.size(), 1024)
self.assertTrue(keyFile.exists())

def test_noRegeneration(self):
Expand All @@ -1687,15 +1687,15 @@ def test_noRegeneration(self):
tempDir = FilePath(self.mktemp())
keyFile = tempDir.child("mykey.pem")

key = keys._getPersistentRSAKey(keyFile, keySize=512)
self.assertEqual(key.size(), 512)
key = keys._getPersistentRSAKey(keyFile, keySize=1024)
self.assertEqual(key.size(), 1024)
self.assertTrue(keyFile.exists())
keyContent = keyFile.getContent()

# Set the key size to 1024 bits. Since it exists already, it will find
# the 512 bit key, and not generate a 1024 bit key.
key = keys._getPersistentRSAKey(keyFile, keySize=1024)
self.assertEqual(key.size(), 512)
# Set the key size to 2048 bits. Since it exists already, it will find
# the 1024 bit key, and not generate a 2048 bit key.
key = keys._getPersistentRSAKey(keyFile, keySize=2048)
self.assertEqual(key.size(), 1024)
self.assertEqual(keyFile.getContent(), keyContent)

def test_keySizeZero(self):
Expand All @@ -1706,6 +1706,6 @@ def test_keySizeZero(self):
tempDir = FilePath(self.mktemp())
keyFile = tempDir.child("mykey.pem")

key = keys._getPersistentRSAKey(keyFile, keySize=512)
key = keys._getPersistentRSAKey(keyFile, keySize=1024)
key._keyObject = None
self.assertEqual(key.size(), 0)
2 changes: 1 addition & 1 deletion src/twisted/conch/test/test_manhole_tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_sshPort(self) -> None:
"--sshKeyDir",
self.mktemp(),
"--sshKeySize",
"512",
"1024",
"--sshPort",
"tcp:223",
]
Expand Down
Empty file.