CertificateRequest#

class CertificateRequest(**properties: Any)#

Superclasses: Object

An object that allows creation of certificate requests. A certificate request is sent to a certificate authority to request an X.509 certificate.

Use prepare to create a blank certificate request for a given private key. Set the common name on the certificate request with set_cn, and then sign the request with complete_async.

Methods#

class CertificateRequest
classmethod capable(cancellable: Cancellable | None = None) bool#

Check whether CertificateRequest is capable of creating a request for the given private_key.

Parameters:

cancellable – cancellation object

classmethod capable_async(cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#

Asynchronously check whether CertificateRequest is capable of creating a request for the given private_key.

Parameters:
  • cancellable – cancellation object

  • callback – will be called when the operation completes

  • user_data – data to be passed to callback

classmethod capable_finish() bool#

Get the result for asynchronously check whether CertificateRequest is capable of creating a request for the given private_key.

complete(cancellable: Cancellable | None = None) bool#

Complete and sign a certificate request, so that it can be encoded and sent to a certificate authority.

This call may block as it signs the request using the private key.

Parameters:

cancellable – a cancellation object

complete_async(cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#

Asynchronously complete and sign a certificate request, so that it can be encoded and sent to a certificate authority.

This call will return immediately and complete later.

Parameters:
  • cancellable – a cancellation object

  • callback – called when the operation completes

  • user_data – data to pass to the callback

complete_finish(result: AsyncResult) bool#

Finish an asynchronous operation to complete and sign a certificate request.

Parameters:

result – result of the asynchronous operation

encode(textual: bool) list[int]#

Encode the certificate request. It must have been completed with complete or complete_async.

If textual is False, the output is a DER encoded certificate request.

If textual is True, the output is encoded as text. For PKCS``10`` requests this is done using the OpenSSL style PEM encoding.

Parameters:

textual – whether to encode output as text

get_format() CertificateRequestFormat#

Get the format of this certificate request.

get_private_key() Object#

Get the private key this certificate request is for.

classmethod prepare(private_key: Object) CertificateRequest#

Create a new certificate request, in the given format for the private key.

Parameters:

private_key – the private key the the certificate is being requested for

set_cn(cn: str) None#

Set the common name encoded in the certificate request.

Parameters:

cn – common name to set on the request

Properties#

class CertificateRequest
props.private_key: Object#

The type of the None singleton.