gdata.tlslite.utils.Python_RSAKey | index /build/buildd/python-gdata-2.0.18+dfsg/src/gdata/tlslite/utils/Python_RSAKey.py

`Pure-Python RSA implementation.`

Modules

``

array base64 | binascii math | os sys | traceback gdata.tlslite.utils.xmltools

Classes

``

gdata.tlslite.utils.RSAKey.RSAKey
  Python_RSAKey

class Python_RSAKey(gdata.tlslite.utils.RSAKey.RSAKey)

``

Methods defined here:

__init__(self, n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0)

acceptsPassword(self)

hasPrivateKey(self)

hash(self)

write(self, indent='')

writeXMLPublicKey(self, indent='')

Static methods defined here:

generate(bits)

parsePEM(s, passwordCallback=None)
  `Parse a string containing a <privateKey> or <publicKey>, or
  PEM-encoded key.`

parseXML(s)

Methods inherited from gdata.tlslite.utils.RSAKey.RSAKey:

__len__(self)
  `Return the length of this key in bits.
  @rtype: int`

decrypt(self, encBytes)
  `Decrypt the passed-in bytes.
  This requires the key to have a private component. It performs
  PKCS1 decryption of the passed-in data.
  @type encBytes: L{array.array} of unsigned bytes
  @param encBytes: The value which will be decrypted.
  @rtype: L{array.array} of unsigned bytes or None.
  @return: A PKCS1 decryption of the passed-in data or None if
  the data is not properly formatted.`

encrypt(self, bytes)
  `Encrypt the passed-in bytes.
  This performs PKCS1 encryption of the passed-in data.
  @type bytes: L{array.array} of unsigned bytes
  @param bytes: The value which will be encrypted.
  @rtype: L{array.array} of unsigned bytes.
  @return: A PKCS1 encryption of the passed-in data.`

getSigningAlgorithm(self)
  `Return the cryptoID sigAlgo value corresponding to this key.
  @rtype: str`

hashAndSign(self, bytes)
  `Hash and sign the passed-in bytes.
  This requires the key to have a private component. It performs
  a PKCS1-SHA1 signature on the passed-in data.
  @type bytes: str or L{array.array} of unsigned bytes
  @param bytes: The value which will be hashed and signed.
  @rtype: L{array.array} of unsigned bytes.
  @return: A PKCS1-SHA1 signature on the passed-in data.`

hashAndVerify(self, sigBytes, bytes)
  `Hash and verify the passed-in bytes with the signature.
  This verifies a PKCS1-SHA1 signature on the passed-in data.
  @type sigBytes: L{array.array} of unsigned bytes
  @param sigBytes: A PKCS1-SHA1 signature.
  @type bytes: str or L{array.array} of unsigned bytes
  @param bytes: The value which will be hashed and verified.
  @rtype: bool
  @return: Whether the signature matches the passed-in data.`

sign(self, bytes)
  `Sign the passed-in bytes.
  This requires the key to have a private component. It performs
  a PKCS1 signature on the passed-in data.
  @type bytes: L{array.array} of unsigned bytes
  @param bytes: The value which will be signed.
  @rtype: L{array.array} of unsigned bytes.
  @return: A PKCS1 signature on the passed-in data.`

verify(self, sigBytes, bytes)
  `Verify the passed-in bytes with the signature.
  This verifies a PKCS1 signature on the passed-in data.
  @type sigBytes: L{array.array} of unsigned bytes
  @param sigBytes: A PKCS1 signature.
  @type bytes: L{array.array} of unsigned bytes
  @param bytes: The value which will be verified.
  @rtype: bool
  @return: Whether the signature matches the passed-in data.`

Functions

``

sha1 = openssl_sha1(...)
  `Returns a sha1 hash object; optionally initialized with a string`

Data
`` |  | cryptlibpyLoaded = False gmpyLoaded = False m2cryptoLoaded = False prngName = 'os.urandom' pycryptoLoaded = False sieve = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ...]