5.5.17.2. PrivateKey methods

MethodDescription
__init__(self, key, key_format, passphrase) Load a private key from a string, and access it using its passphrase
fromFile(key_file_path, passphrase) Load a private key from a file, and access it using its passphrase
fromURI(key_uri, passphrase) Load a private key from an Universal Resource Identifier (URI) string.

Table 5.54. Method summary

Method __init__(self, key, key_format, passphrase)

Initializes a PrivateKey instance by loading a private key from a string, and accesses it using its passphrase. To load a private key from a file, use the PrivateKey.fromFile method.

Arguments of __init__
key_file_path (certificate)
Default: n/a
The path and filename to the private key file. The private key must be in PEM format.

passphrase (string)
Default: None
Passphrase used to access the private key specified in key_file_path.

Method fromFile(key_file_path, passphrase)

Initializes a PrivateKey instance by loading a private key from a file, and accesses it using its passphrase.

Arguments of fromFile
key_file_path (certificate)
Default: n/a
The path and filename to the private key file. The private key must be in PEM format.

passphrase (string)
Default: None
Passphrase used to access the private key specified in key_file_path.

Method fromURI(key_uri, passphrase)

Initializes a PrivateKey instance by loading a private key from an URI. Supported URI schemes are 'file:' and 'pkcs11:' for loading a private key from an external file, or from a HSM device. URI can contain authentiction information (e.g. PIN code) also. Note, the URI string will be stored unencrypted.

Arguments of fromURI
key_uri (string)
Default: n/a
The URI to accessing the private key.

passphrase (string)
Default: None
Passphrase used to access the private key specified in key_uri.