Skip to content

Commit

Permalink
#12095 Increase RSA keys generated in tests (#12095)
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Jan 28, 2024
2 parents 11c9f58 + afb013b commit f35f891
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
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.

0 comments on commit f35f891

Please sign in to comment.