Example #1
0
    def test_load_crypto_public_key(self):
        """
        verifies that a public key can be loaded
        """
        self.destroy_key_files()
        try:
            # create keys and save the public key
            pub, priv = generate_keys(KEY_SIZE)
            self.create_key_file(pub)

            #get the public key data back
            pub_key = load_crypto(KEY_FILE, False, both=False)
            priv_key = RSA.construct(priv)

            self.verify_keys(pub_key, priv_key)
        finally:
            self.destroy_key_files()
Example #2
0
    def test_generate_keys(self):
        """
        Test generation of keys.

        validate:
            * structure of key
            * key pair functions
        """
        pub, priv = generate_keys(KEY_SIZE)

        #check array lengths
        self.assertEqual(len(pub), 2, 'Publickey array incorrect size')
        self.assertEqual(len(priv), 5, 'Privatekey array incorrect size')

        pub_key = RSA.construct(pub)
        priv_key = RSA.construct(priv)

        self.verify_keys(pub_key, priv_key)
Example #3
0
 def setUp(self):
     pub, priv = generate_keys(KEY_SIZE)
     self.pub_key = RSA.construct(pub)
     self.priv_key = RSA.construct(priv)
Example #4
0
 def setUp(self):
     pub, priv = generate_keys(KEY_SIZE)
     self.pub_key = RSA.construct(pub)
     self.priv_key = RSA.construct(priv)
     self.callback_avatar = None