encode(data,
marker,
passphrase=None,
randfunc=None)
|
|
Encode a piece of binary data into PEM format.
- Parameters:
data (byte string) - The piece of binary data to encode.
marker (string) - The marker for the PEM block (e.g. "PUBLIC KEY").
Note that there is no official master list for all allowed markers.
Still, you can refer to the OpenSSL source code.
passphrase (byte string) - If given, the PEM block will be encrypted. The key is derived from
the passphrase.
randfunc (callable) - Random number generation function; it accepts an integer N and returns
a byte string of random data, N bytes long. If not given, a new one is
instantiated.
- Returns:
- The PEM block, as a string.
|