Esempio n. 1
0
 def test_9_sign_dss(self):
     # verify that the dss private key can sign and verify
     key = DSSKey.from_private_key_file("tests/test_dss.key")
     msg = key.sign_ssh_data(rng, b"ice weasels")
     self.assert_(type(msg) is Message)
     msg.rewind()
     self.assertEquals(b"ssh-dss", msg.get_string())
     # can't do the same test as we do for RSA, because DSS signatures
     # are usually different each time.  but we can test verification
     # anyway so it's ok.
     self.assertEquals(40, len(msg.get_string()))
     msg.rewind()
     pub = DSSKey(data=bytes(key))
     self.assert_(pub.verify_ssh_sig(b"ice weasels", msg))
Esempio n. 2
0
 def test_9_sign_dss(self):
     # verify that the dss private key can sign and verify
     key = DSSKey.from_private_key_file('tests/test_dss.key')
     msg = key.sign_ssh_data(rng, 'ice weasels')
     self.assert_(type(msg) is Message)
     msg.rewind()
     self.assertEquals('ssh-dss', msg.get_string())
     # can't do the same test as we do for RSA, because DSS signatures
     # are usually different each time.  but we can test verification
     # anyway so it's ok.
     self.assertEquals(40, len(msg.get_string()))
     msg.rewind()
     pub = DSSKey(data=str(key))
     self.assert_(pub.verify_ssh_sig('ice weasels', msg))