Пример #1
0
    def __init__(self, cryptosystem, private_key_value):
        """
        Creates a new private key. Should not be invoked directly.
        
        Instead of using this constructor from outside of PloneVoteCryptoLib, 
        please use the class methods EGCryptoSystem.new_key_pair() or 
        PrivateKey.from_file(file).
        
        Arguments:
            cryptosystem::EGCryptoSystem-- The ElGamal cryptosystem in which 
                                           this key is defined.
            private_key_value::long     -- The actual value of the private key.
        """
        public_key_value = pow(cryptosystem.get_generator(), private_key_value,
                               cryptosystem.get_prime())

        self.cryptosystem = cryptosystem
        self.public_key = PublicKey(cryptosystem, public_key_value)
        self._key = private_key_value