pki.util.cert_req_converter

Adapter to convert from CertificateSigningRequest to JSON certificate request dict.

Module Contents

pki.util.cert_req_converter.logger[source]
class pki.util.cert_req_converter.JSONCertRequestConverter[source]

Adapter to convert from CertificateSigningRequest to JSON certificate request dict.

static to_json(csr)[source]

Convert a CSR to a JSON request dict.

Parameters:

csr (cryptography.x509.CertificateSigningRequest | cryptography.x509.CertificateBuilder | None)

Return type:

dict[str, Any]

static validity_period_from_json(validity)[source]

Parses validity period from JSON.

Parameters:

validity (dict[str, Any])

Return type:

datetime.timedelta

static from_json(json)[source]

Convert a JSON request dict to a CertificateBuilder.

Parameters:

json (dict[str, Any]) – JSON dictionary containing certificate request data

Returns:

Certificate builder with all data from JSON applied

Return type:

cryptography.x509.CertificateBuilder

class pki.util.cert_req_converter.JSONCertRequestCommandExtractor[source]

Adapter to extract defaults and values from a profile for use in OpenSSL commands (help pages).

static sample_request_to_openssl_subj(sample_req)[source]

Convert profile subject to OpenSSL command line subject string.

Parameters:

sample_req (dict[str, Any])

Return type:

str

static sample_request_to_openssl_cmp_sans(sample_req)[source]

Convert profile SANs to OpenSSL CMP command line -sans string.

Parameters:

sample_req (dict[str, Any])

Return type:

str

static sample_request_to_openssl_req_sans(sample_req)[source]

Convert profile SANs to OpenSSL req command line -addext string.

Parameters:

sample_req (dict[str, Any])

Return type:

str

static sample_request_to_openssl_days(sample_req)[source]

Extract validity days from profile for OpenSSL CMP command line -days option.

Parameters:

sample_req (dict[str, Any])

Return type:

int