module bluerpc_client.crypto
function create_certs
create_certs(
country,
common_name,
organization='BlueRPC',
validity: timedelta = datetime.timedelta(days=35000),
key_size=2048,
signing_key: RSAPrivateKey | None = None,
issuer_cert: Certificate | None = None
) → (<class 'RSAPrivateKey'>, <class 'Certificate'>)
Helper to create certificates for bluerpc
Args:
country
: the country namecommon_name
: the common name, if generating for a worker, make sure to set it as the worker iporganization
: the organization namevalidity
: the period of validity for this certkey_size
: the key sizesigning_key
: the key to be used to sign the certificate, use the key from a CA or leave empty to create a self-signed certissuer_cert
: the certificated corresponding to the signing key
Returns:
(rsa.RSAPrivateKey, x509.Certificate)
: a tuple of the private key and the certificate
function serialize_certs
serialize_certs(data: RSAPrivateKey | Certificate) → bytes
Helper to serialize a private key or a certificate
Args:
data
: an RSAPrivateKey or a Certificate object
Returns:
bytes
: a PEM encoded file
function create_keystore
create_keystore(
key: RSAPrivateKey,
cert: Certificate,
ca_cert: Certificate,
password: str
)
Helper to create a keystore with the key/cert of a worker and the CA cert
Args:
key
: the private key of the workercert
: the certificate of the worker (signed by the CA)ca_cert
: the CA certpassword
: the password of the pfxname
: the name of the pfx
Returns:
bytes
: the pfx file
function load_certs
load_certs(
key: bytes | None,
cert: bytes | None
) → (RSAPrivateKey | None, Certificate | None)
Helper to load certificates from bytes
Args:
key
: a PEM encoded keycert
: a PEM encoded cert
Returns:
(rsa.RSAPrivateKey|None, x509.Certificate|None)
: a tuple of the private key and the certificate
This file was automatically generated via lazydocs.