export_public

KeyManager.export_public(**kwargs)bytes[source]

Serialize the cryptography public key instance loaded into KeyManager into storable bytes.

This method works whether you’ve instantiated KeyManager with the public key directly, or the private key, as the public key is automatically interpolated from the private key by __init__()

Example:

>>> km = KeyManager.load_keyfile('id_ed25519.pub')
>>> km.export_public()
b'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA6vtKgeNSBERSY1xmr47Ve3uyRALxPR+qOeFeUHrUaf'
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 from default_formats

Return bytes key

The serialized key.