pyjsbn-rsa
Python RSA module compatible with jsbn.js.
Installation
pyjsbn-rsa is available via PyPI
pip install pyjsbn-rsa
via setup.py
python setup.py install
Basic Use
You can test module with jsbn's RSA Encryption Demo
>>from jsbn import RSAKey
>>rsa = RSAKey()
>>rsa.generate(1024,"10001")
>>hex(rsa.n)
0xdc36096d038a56e84c6290f33db80dce54413e89dc15f0490dde8f1f58e69d957eed66c9537918b8fefd6a3fc9fc7b2551ac595bc77c2b98bcfa13f7deb17e94890ae4f28016f0d3e09450054263ae71f81539b09ea42b854492691e94de5671835b4ce91b9756b651ec4bbebe63eec8b7274e157b8de07457f2d3563119ac53L
Paste rsa.n to demo's Modulus (hex) and press encryt. (without "0x" and "L") And, get Ciphertext (hex) value
>>ctext="ceffa610eb7ec7fcbda60b2fdecf6d7cc65b7304ecb6e327056f15d763f1d079d376dbc801861a0ccb2731f836e75de0bb22350b3cd0d18eed216619b9e64a59dc06e15ef2531f0d3c176882444c5919dd751e9bcaefadff372d847b001a298751ebc69f9d310d92c217ab2fa433e3b3c7e8edf4744849560a317ef7f4ee7266"
>>rsa.decrypt(ctext)
'Hello World!'
Methods
You can use main methods of rsa.js and rsa2.js
setPublic
Set the public key fields N and e from hex strings.
>>rsa.setPublic(n,e)
setPrivate
Set the private key fields N, e, and d from hex strings.
>>rsa.setPrivate(n,e,d)
setPrivateEx
Set the private key fields N, e, d and CRT params from hex strings.
>>rsa.setPrivateEx(n,e,d,p,q,dp,dq,c)
encrypt
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.
>>rsa.encrypt(text)
decrypt
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.
>>rsa.decrypt(ctext)
generate
Generate a new random private key B bits long, using public expt E
>>rsa.generate(b,e)
Metadata
Release files for pyjsbn-rsa 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyjsbn-rsa-0.4.2.tar.gz | 4.2 kB | Without provenance | Details for pyjsbn-rsa-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyjsbn_rsa-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for pyjsbn_rsa-0.4.2-py3-none-any.whl |
Total release size: 8.5 kB
Release files / pyjsbn-rsa-0.4.2.tar.gz
| Download URL | pyjsbn-rsa-0.4.2.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66087e1d8864a3d710c08a2a84d8a7fa52d0119f9f6cf8216e8c5eea4132ec38
|
|
BLAKE2b-256 checksum How to use checksums |
704ed879adc14ad4ebe015437bdd443a1ca38ee0d108f37ccd035e61ef95bcff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Release files / pyjsbn_rsa-0.4.2-py3-none-any.whl
| Download URL | pyjsbn_rsa-0.4.2-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2fbd25a8772ac220ff0d2e3b93e7e924ccb96a440412512bd2c94899d7585109
|
|
BLAKE2b-256 checksum How to use checksums |
37e48c2176868d4e8acc1bedf8bfaf80f17f354186d8a7c9ba4ceec8eab472a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Security for pyjsbn-rsa 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.