tlslite.utils.python_rsakey module¶
Pure-Python RSA implementation.
-
class
tlslite.utils.python_rsakey.
Python_RSAKey
(n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0, key_type='rsa')¶ Bases:
tlslite.utils.rsakey.RSAKey
-
__init__
(n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0, key_type='rsa')¶ Initialise key directly from integers.
see also generate() and parsePEM().
-
acceptsPassword
()¶ Does it support encrypted key files.
-
static
generate
(bits, key_type='rsa')¶ Generate a private key with modulus ‘bits’ bit big.
key_type can be “rsa” for a universal rsaEncryption key or “rsa-pss” for a key that can be used only for RSASSA-PSS.
-
hasPrivateKey
()¶ Does the key has the associated private key (True) or is it only the public part (False).
-
static
parsePEM
(data, password_callback=None)¶ Parse a string containing a PEM-encoded <privateKey>.
-
-
tlslite.utils.python_rsakey.
bytes_to_int
(bytes, byteorder, *, signed=False)¶ Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.