Pem class

class cryptosyspki.Pem

PEM file conversion routines.

class EOL

Line ending options.

DEFAULT = 0

Windows CR-LF line endings (default)

UNIX = 131072

Unix/SSL LF line endings

WINDOWS = 0

Windows CR-LF line endings

static from_binfile(outputfile, filein, header, linelen=64, eol=0)

Create a PEM file from a binary file.

Parameters:
  • outputfile (str) -- Name of PEM file to create

  • filein (str) -- Name of input binary file. Any input file is accepted and treated as binary data. No checks are made that the header matches the data.

  • header (str) -- Header to be used. Leave empty to omit the PEM header and footer.

  • linelen (int) -- Maximum length of a line in the resulting PEM file [default = 64 characters]

  • eol (EOL) -- Line ending option [default = Windows CR-LF endings]

Returns:

Zero if successful.

Return type:

int

static to_binfile(outputfile, filein)

Convert the contents of a PEM file into a binary file.

Parameters:
  • outputfile (str) -- Name of binary file to create.

  • filein (str) -- Name of input PEM file

Returns:

Zero if successful.

Return type:

int