For programmers to need to encrypt and decrypt data with RSA by python,this tested source code is useful.
It is available to generate RSA key pair and encrypt by public key,decrypt by private key.
Also it is available to create and verify digital signature with various hash algorithm like md5/sha1/sha256/sha224/sha384/sha512,using private key and public key.
Specification
ID | STCD_0000000004 |
Language | Python |
Steps | 113 |
Purpose | Encrypt and Decrypt data with RSA. |
Function | Encrypt data with RSA. Decrypt data with RSA. Create digital signature with RSA. Verify digital signature with RSA. |
Environment | Anaconda3(Python 3.9.7) IDE : Visual Studio Code PyCryptodome |
Restriction | free license You can use source code copy as owner . You can customize and distribute it freely. |
Price | 7 dollars or 700 yen (Pay with PayPal) |
References | https://ameblo.jp/namuyan/entry-12337764948.html https://y0m0r.hateblo.jp/entry/20130607/1370616817 https://pycryptodome.readthedocs.io/en/latest/src/public_key/rsa.html https://telecom-engineer.blog/blog/2022/05/02/python-rsa-padding/ https://www.dlitz.net/software/pycrypto/api/2.6/Crypto.Cipher.PKCS1_OAEP.PKCS1OAEP_Cipher-class.html#encrypt https://qiita.com/kj1/items/aebbb73a034f36d73e40 |
Source Code
Test Result
NO | test case | result |
01 | encryption / decryption test with various key bit length. – 1024/2048/3072 bit | OK |
02 | creation test of digital signature with various hash algorithm. – md5/sha1/sha256/sha224/sha384/sha512 | OK |
03 | max encryption data length test with various key bit length. – 1024/2048/3072 bit | OK |
Test Code
*) Modify “path” along your PC environment.
History
23/11/2022 created
Provider Profile
Nick name is “Dead Fish” employed as an engineer in Japan.
I am grad if you need my code.
Thanks !
Download
Get download passwordSTCD_0000000004
1 file(s) 0.18 KB
Following files and data are zipped.
└── RsaClass.py
Remarks
None
Comments