pkenc_rsa

From: “Rivest-Shamir-Adleman Standard algorithm”.
Published in: 1978
Security Assumption: RSA factoring
  • type: public-key encryption
  • setting: Integer
Authors:J 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: pkenc_rsa.RSA, charm.toolbox.PKEnc.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: pkenc_rsa.RSA, charm.toolbox.PKSig.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]