Skip to main content

Python RSA module compatible with jsbn.js

Project description


Build Status

Python RSA module compatible with jsbn.js.


pyjsbn-rsa is available via PyPI

pip install pyjsbn-rsa


python install

Basic Use

You can test module with jsbn's RSA Encryption Demo

>>from jsbn import RSAKey
>>rsa = RSAKey()

Paste rsa.n to demo's Modulus (hex) and press encryt. (without "0x" and "L") And, get Ciphertext (hex) value

'Hello World!'


You can use main methods of rsa.js and rsa2.js


Set the public key fields N and e from hex strings.



Set the private key fields N, e, and d from hex strings.



Set the private key fields N, e, d and CRT params from hex strings.



Return the PKCS#1 RSA encryption of "text" as an even-length hex string. You should do setPublic, setPrivate, setPrivateEx or generate first. text must be unicode for Python 2 and str for Python 3.



Return the PKCS#1 RSA decryption of "ctext". "ctext" is an even-length hex string and the output is a plain string. You should do setPrivate, setPrivateEx or generate first.



Generate a new random private key B bits long, using public expt E


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyjsbn-rsa, version 0.4.1
Filename, size File type Python version Upload date Hashes
Filename, size pyjsbn-rsa-0.4.1.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page