python-dirbtuves / internet-voting

Internet voting system.
1 stars 2 forks source link

Generate and serialize private and public keys #10

Open sirex opened 9 years ago

sirex commented 9 years ago

Generate primary and public keys and return serialized values of these keys.

For this we need a wrapper functions with following API:

serialized_private_key, serialized_public_key = generate(password)
primary_key = load_private_key(serialized_private_key, password)
public_key = load_public_key(serialized_public_key)

serialization.Encoding.DER serialization encoding should be used. And for the encoding use serialization.PrivateFormat.PKCS8 for private key and serialization.PublicFormat.SubjectPublicKeyInfo for public key.

See: https://cryptography.io/en/latest/hazmat/primitives/asymmetric/rsa/