Puya RSA
Algorand Puya RSA RFC8017 RSASSA-PKCS1-V1.5-VERIFY function implementation. Intended to allow on-chain verification of RSA signatures seen in practice (e.g. JWT signatures), compliant with the Public Key Cryptography Standard v1.5. See RFC Section 8.2.2.
⚠️ Not officially production ready until documentation updated to indicate otherwise. Use at your own risk.
Features
- Supports up to
1024 bytes(8192 bits) long modulus - RSASSA-PKCS1-V1.5-VERIFY function implementation
Install
Puya RSA is available on PyPI:
pip install puya-rsa
Usage
All inputs to math functions are assumed to be big-endian encoded numbers unless explicitly stated otherwise.
from puya_rsa import (
pkcs1_v15_verify
)
# ... pkcs1_v15_verify(msg_digest_info, signature, public_modulus, exponent, barrett_reduction_factor)
The pkcs1_v15_verify function arguments are as follows:
msg_digest_infois a message digest with an identifier of the hashing function prependedsignatureis the signature used to sign the messagepublic_modulusis the public RSA key (modulus)exponentis the exponent used to generate the RSA key (typically2**16)barrett_reduction_factoris a precomputed factor according to the Barrett Reduction algorithm, which depends on the public key modulus. This must be calculated on-chain and proven (e.g. in contract state) to be trustless, otherwise it would act as a magic number. SeePuya BigNumber.
Develop
This module uses poetry as the package manager and Python environment manager. Please see How to Build and Publish Python Packages With Poetry.
Test
poetry run pytest -v
License & Contribution
Contributions and additions are welcomed. Please respect the terms of the GNU GPL v3 license. Attribution for the author Winton Nathan-Roberts is required. No warranties or liabilities per the license. It is not yet officially production ready, although it is thoroughly tested.
Metadata
Release files for puya-rsa 0.2.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 | |
|---|---|---|---|
| puya_rsa-0.2.2.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| puya_rsa-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.4 kB
Release files / puya_rsa-0.2.2.tar.gz
| Download URL | puya_rsa-0.2.2.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a730928f13907edab332bcbbe0bb1b6aa592168d0d5104e9f67d3f389726739
|
|
BLAKE2b-256 checksum How to use checksums |
1647ef7d8197dba72bc1cbe392b01c1c3f8d3cb821604329be0d9928dc55db1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.5 Linux/6.10.9-350.vanilla.fc40.x86_64
|
Release files / puya_rsa-0.2.2-py3-none-any.whl
| Download URL | puya_rsa-0.2.2-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fbdc47440f7c7e04f4d68d9e8281a169615f148848948b23b2312e97ca8c7a24
|
|
BLAKE2b-256 checksum How to use checksums |
e4f7bb5a9f53fcb4404f521ae6a7a0f54a241bb303fd068294e6a34ac4d283a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.5 Linux/6.10.9-350.vanilla.fc40.x86_64
|