Example #1
0
 def test_signRSA(self):
     """
     Test that RSA keys return appropriate signatures.
     """
     data = 'data'
     key, sig = self._signRSA(data)
     sigData = keys.pkcs1Digest(data, keys.lenSig(key))
     v = key.sign(sigData, '')[0]
     self.assertEqual(sig, common.NS('ssh-rsa') + common.MP(v))
     return key, sig
Example #2
0
 def test_signRSA(self):
     """
     Test that RSA keys return appropriate signatures.
     """
     data = 'data'
     key, sig = self._signRSA(data)
     sigData = keys.pkcs1Digest(data, keys.lenSig(key))
     v = key.sign(sigData, '')[0]
     self.assertEqual(sig, common.NS('ssh-rsa') + common.MP(v))
     return key, sig
Example #3
0
 def test_pkcs1(self):
     """
     Test Public Key Cryptographic Standard #1 functions.
     """
     data = 'ABC'
     messageSize = 6
     self.assertEqual(keys.pkcs1Pad(data, messageSize), '\x01\xff\x00ABC')
     hash = sha1().digest()
     messageSize = 40
     self.assertEqual(keys.pkcs1Digest('', messageSize),
                      '\x01\xff\xff\xff\x00' + keys.ID_SHA1 + hash)
Example #4
0
 def test_pkcs1(self):
     """
     Test Public Key Cryptographic Standard #1 functions.
     """
     data = 'ABC'
     messageSize = 6
     self.assertEqual(keys.pkcs1Pad(data, messageSize),
             '\x01\xff\x00ABC')
     hash = sha1().digest()
     messageSize = 40
     self.assertEqual(keys.pkcs1Digest('', messageSize),
             '\x01\xff\xff\xff\x00' + keys.ID_SHA1 + hash)