def testRsaSpecificValues(self): self.assertRaises(errors.OpPrereqError, ssh.DetermineKeyBits, "dsa", 766, None, None) for b in [768, 769, 2048, 2049, 4096]: self.assertEquals(b, ssh.DetermineKeyBits("rsa", b, None, None))
def testEcdsaSpecificValues(self): self.assertRaises(errors.OpPrereqError, ssh.DetermineKeyBits, "ecdsa", 2048, None, None) for b in [256, 384, 521]: self.assertEquals(b, ssh.DetermineKeyBits("ecdsa", b, None, None))
def testAdoptOldKeySize(self): self.assertEquals(4098, ssh.DetermineKeyBits("rsa", None, "rsa", 4098)) self.assertEquals(2048, ssh.DetermineKeyBits("rsa", None, "dsa", 1024))
def testDsaSpecificValues(self): self.assertRaises(errors.OpPrereqError, ssh.DetermineKeyBits, "dsa", 2048, None, None) self.assertRaises(errors.OpPrereqError, ssh.DetermineKeyBits, "dsa", 512, None, None) self.assertEquals(1024, ssh.DetermineKeyBits("dsa", None, None, None))
def testAdoptDefault(self): self.assertEquals(2048, ssh.DetermineKeyBits("rsa", None, None, None)) self.assertEquals(1024, ssh.DetermineKeyBits("dsa", None, None, None))