pkenc_rsa

RSA Public Key Encryption Scheme (RSA)

Authors: R. Rivest, A. Shamir, L. Adleman

Title: “A Method for Obtaining Digital Signatures and Public-Key Cryptosystems”
Published in: Communications of the ACM, 1978
Available from:
Notes:

Scheme Properties

  • Type: encryption (public key)

  • Setting: Integer

  • Assumption: RSA (Integer Factorization)

Implementation

Authors:
  1. Ayo Akinyele, Gary Belvin

Date:

07/2011

class pkenc_rsa.RSA[source]

Bases: object

convert(N, e, d, p, q)[source]
keygen(secparam=1024, params=None)[source]
paramgen(secparam)[source]
class pkenc_rsa.RSA_Enc(padding=<charm.toolbox.paddingschemes.OAEPEncryptionPadding object>, params=None)[source]

Bases: RSA, PKEnc

>>> rsa = RSA_Enc()
>>> (public_key, secret_key) = rsa.keygen(1024)
>>> msg = b'This is a test'
>>> cipher_text = rsa.encrypt(public_key, msg)
>>> decrypted_msg = rsa.decrypt(public_key, secret_key, cipher_text)
>>> decrypted_msg == msg
True
decrypt(pk, sk, c)[source]
encrypt(pk, m, salt=None)[source]
class pkenc_rsa.RSA_Sig(padding=<charm.toolbox.paddingschemes.PSSPadding object>)[source]

Bases: RSA, PKSig

>>> msg = b'This is a test message.'
>>> rsa = RSA_Sig()
>>> (public_key, secret_key) = rsa.keygen(1024)
>>> signature = rsa.sign(secret_key, msg)
>>> rsa.verify(public_key, msg, signature)
True
sign(sk, M, salt=None)[source]
verify(pk, M, S)[source]