pyhanko.keys package

Submodules

pyhanko.keys.pemder module

pyhanko.keys.pemder.load_cert_from_pemder(cert_file)

A convenience function to load a single PEM/DER-encoded certificate from a file.

Parameters:

cert_file – A file name.

Returns:

An asn1crypto.x509.Certificate object.

pyhanko.keys.pemder.load_certs_from_pemder(cert_files)

A convenience function to load PEM/DER-encoded certificates from files.

Parameters:

cert_files – An iterable of file names.

Returns:

A generator producing asn1crypto.x509.Certificate objects.

pyhanko.keys.pemder.load_certs_from_pemder_data(cert_data_bytes: bytes)

A convenience function to load PEM/DER-encoded certificates from binary data.

Parameters:

cert_data_bytesbytes object from which to extract certificates.

Returns:

A generator producing asn1crypto.x509.Certificate objects.

pyhanko.keys.pemder.load_private_key_from_pemder(key_file, passphrase: bytes | None) PrivateKeyInfo

A convenience function to load PEM/DER-encoded keys from files.

Parameters:
  • key_file – File to read the key from.

  • passphrase – Key passphrase.

Returns:

A private key encoded as an unencrypted PKCS#8 PrivateKeyInfo object.

pyhanko.keys.pemder.load_private_key_from_pemder_data(key_bytes: bytes, passphrase: bytes | None) PrivateKeyInfo

A convenience function to load PEM/DER-encoded keys from binary data.

Parameters:
  • key_bytesbytes object to read the key from.

  • passphrase – Key passphrase.

Returns:

A private key encoded as an unencrypted PKCS#8 PrivateKeyInfo object.