export_private¶
-
KeyManager.
export_private
(**kwargs) → bytes[source]¶ Serialize the cryptography private key instance loaded into
KeyManager
into storable bytes.This method requires that you’ve instantiated KeyManager with the private key. It will raise a
EncryptionError
exception if theprivate_key
instance attribute is empty.Example:
>>> km = KeyManager.load_keyfile('id_ed25519') >>> print(km.export_private().decode()) -----BEGIN PRIVATE KEY----- MC4CAQAwBQYDK2VwBCIEIOeLS2XOcQz11VUnzh6KIZaNtT10YfzHv779zjm95XSy -----END PRIVATE KEY-----
- Parameters
format (Format) – Override some or all of the default format/encoding for the keys. Dict Keys: private_format,public_format,private_encoding,public_encoding
format – If passed a
Format
instance, then this instance will be used for serialization instead of merging defaults fromdefault_formats
- Return bytes key
The serialized key.