Class: QgsPkiBundle

class qgis.core.QgsPkiBundle(clientCert: QSslCertificate = QSslCertificate(), clientKey: QSslKey = QSslKey(), caChain: Iterable[QSslCertificate] = [])

Bases: sip.wrapper

Construct a bundle from existing PKI components

Parameters
  • clientCert – Certificate to store in bundle

  • clientKey – Private key to store in bundle

  • caChain – Chain of Certificate Authorities for client certificate

QgsPkiBundle(QgsPkiBundle)

Storage set for PKI bundle: SSL certificate, key, optional CA cert chain

Note

Useful for caching the bundle during application run sessions

Methods

caChain

Chain of Certificate Authorities for client certificate

certId

The sha hash of the client certificate

clientCert

Client certificate object

clientKey

Private key object

fromPemPaths

Construct a bundle of PKI components from PEM-formatted file paths

fromPkcs12Paths

Construct a bundle of PKI components from a PKCS#12 file path

isNull

Whether the bundle, either its certificate or private key, is null

isValid

Whether the bundle is valid

setCaChain

Sets chain of Certificate Authorities for client certificate

setClientCert

Sets client certificate object

setClientKey

Sets private key object

caChain(self) List[QSslCertificate]

Chain of Certificate Authorities for client certificate

Return type

List[QSslCertificate]

certId(self) str

The sha hash of the client certificate

Return type

str

clientCert(self) QSslCertificate

Client certificate object

Return type

QSslCertificate

clientKey(self) QSslKey

Private key object

Return type

QSslKey

fromPemPaths(certPath: str, keyPath: str, keyPass: str = '', caChain: Iterable[QSslCertificate] = []) QgsPkiBundle

Construct a bundle of PKI components from PEM-formatted file paths

Parameters
  • certPath (str) – Certificate file path

  • keyPath (str) – Private key path

  • keyPass (str = '') – Private key passphrase

  • caChain (Iterable[QSslCertificate] = []) – Chain of Certificate Authorities for client certificate

Return type

QgsPkiBundle

fromPkcs12Paths(bundlepath: str, bundlepass: str = '') QgsPkiBundle

Construct a bundle of PKI components from a PKCS#12 file path

Parameters
  • bundlepath (str) – Bundle file path

  • bundlepass (str = '') – Optional bundle passphrase

Return type

QgsPkiBundle

isNull(self) bool

Whether the bundle, either its certificate or private key, is null

Return type

bool

isValid(self) bool

Whether the bundle is valid

Return type

bool

setCaChain(self, cachain: Iterable[QSslCertificate])

Sets chain of Certificate Authorities for client certificate

Parameters

cachain (Iterable[QSslCertificate]) –

setClientCert(self, cert: QSslCertificate)

Sets client certificate object

Parameters

cert (QSslCertificate) –

setClientKey(self, certkey: QSslKey)

Sets private key object

Parameters

certkey (QSslKey) –