Skip to main content

PrivateKey

Represents a private key.

Attributes

AttributeTypeDescription
_keyrsa.RSAPrivateKeyThe internal RSA private key object used for signing data and cryptographic operations.

Constructor

Signature

def PrivateKey(
key: string|bytes,
password: string|bytes = None
) - > null

Parameters

NameTypeDescription
key`stringbytes`
password`stringbytes` = None

Signature

def PrivateKey(
key: string|bytes,
password: string|bytes = null
) - > null

Parameters

NameTypeDescription
key`stringbytes`
password`stringbytes` = null

Methods


sign()

@classmethod
def sign(
data: string|bytes,
digest: hashes.HashAlgorithm
) - > bytes

Sign string containing data.

Parameters

NameTypeDescription
data`stringbytes`
digesthashes.HashAlgorithmThe cryptographic hash algorithm instance used to compute the message digest and configure the MGF1 mask generation function.

Returns

TypeDescription
bytesThe digital signature generated from the input data using RSA-PSS padding.