Class: QgsPkiBundle

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

Note

Useful for caching the bundle during application run sessions

class qgis.core.QgsPkiBundle[source]

Bases: object

__init__(clientCert: QSslCertificate = QSslCertificate(), clientKey: QSslKey = QSslKey(), caChain: Iterable[QSslCertificate] = [])

Construct a bundle from existing PKI components

Parameters:
  • clientCert (QSslCertificate = QSslCertificate()) – Certificate to store in bundle

  • clientKey (QSslKey = QSslKey()) – Private key to store in bundle

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

__init__(a0: QgsPkiBundle)
Parameters:

a0 (QgsPkiBundle)

caChain(self) List[QSslCertificate]

Chain of Certificate Authorities for client certificate

Return type:

List[QSslCertificate]

certId(self) str[source]

The sha hash of the client certificate

Return type:

str

clientCert(self) QSslCertificate[source]

Client certificate object

Return type:

QSslCertificate

clientKey(self) QSslKey[source]

Private key object

Return type:

QSslKey

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

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

Parameters:
  • certPath (Optional[str]) – Certificate file path

  • keyPath (Optional[str]) – Private key path

  • keyPass (Optional[str] = '') – Private key passphrase

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

Return type:

QgsPkiBundle

fromPkcs12Paths(bundlepath: str | None, bundlepass: str | None = '') QgsPkiBundle[source]

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

Parameters:
  • bundlepath (Optional[str]) – Bundle file path

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

Return type:

QgsPkiBundle

isNull(self) bool[source]

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

Return type:

bool

isValid(self) bool[source]

Whether the bundle is valid

Return type:

bool

setCaChain(self, cachain: Iterable[QSslCertificate])[source]

Sets chain of Certificate Authorities for client certificate

Parameters:

cachain (Iterable[QSslCertificate])

setClientCert(self, cert: QSslCertificate)[source]

Sets client certificate object

Parameters:

cert (QSslCertificate)

setClientKey(self, certkey: QSslKey)[source]

Sets private key object

Parameters:

certkey (QSslKey)