eta_nexus.util.auth_utils module
- class eta_nexus.util.auth_utils.KeyCertPair(key: PrivateKey, cert: x509.Certificate)[source]
Bases:
ABCKeyCertPair is a wrapper for an RSA private key file and a corresponding x509 certificate. Implementations provide a contextmanager “tempfiles”, which provides access to the certificate files and the properties key and cert, which contain the RSA key and certificate information.
- property key: PrivateKey
RSA private key for the certificate.
- property cert: Certificate
x509 certificate information.
- class eta_nexus.util.auth_utils.SelfsignedKeyCertPair(common_name: str, passphrase: str | None = None, country: str | None = None, province: str | None = None, city: str | None = None, organization: str | None = None)[source]
Bases:
KeyCertPairSelf signed key and certificate pair for use with the connections.
- Parameters:
common_name – Common name the certificate should be valid for.
passphrase – Pass phrase for encryption of the private key.
country – Country code for the certificate owner, for example “DE” or “US”.
province – Province name of the certificate owner. Empty by default.
city – City name of the certificate owner. Empty by default.
organization – Name of the certificate owner’s organization. “OPC UA Client” by default.
- generate_cert(common_name: str, country: str | None = None, province: str | None = None, city: str | None = None, organization: str | None = None) tuple[RSAPrivateKey, Certificate][source]
Generate a self signed key and certificate pair for use with the connections.
- Parameters:
common_name – Common name the certificate should be valid for.
country – Alpha-2 country code for the certificate owner. Empty by default.
province – Province name of the certificate owner. Empty by default.
city – City name of the certificate owner. Empty by default.
organization – Name of the certificate owner’s organization. “OPC UA Client” by default.
- Returns:
Tuple of RSA private key and x509 certificate.
- class eta_nexus.util.auth_utils.PEMKeyCertPair(key_path: Path, cert_path: Path, passphrase: str | None)[source]
Bases:
KeyCertPairLoad a PEM formatted key and certificate pair from files.
- Parameters:
key_path – Path to the PEM formatted RSA private key file.
cert_path – Path to the PEM formatted certificate file.
passphrase – Pass phrase for encryption of the private key.