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/