Skip to main content

Python RSA module compatible with jsbn.js

Project description


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.

Source Distribution

pyjsbn-rsa-0.4.2.tar.gz (4.2 kB view hashes)

Uploaded source

Built Distribution

pyjsbn_rsa-0.4.2-py3-none-any.whl (4.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page