Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Pure Python RSA implementation

PyPI Build Status Coverage Status Code Climate

Python-RSA is a pure-Python RSA implementation. It supports encryption and decryption, signing and verifying signatures, and key generation according to PKCS#1 version 1.5. It can be used as a Python library as well as on the commandline. The code was mostly written by Sybren A. Stüvel.

Documentation can be found at the Python-RSA homepage. For all changes, check the changelog.

Download and install using:

pip install rsa

or download it from the Python Package Index.

The source code is maintained at GitHub and is licensed under the Apache License, version 2.0

Security

Because of how Python internally stores numbers, it is very hard (if not impossible) to make a pure-Python program secure against timing attacks. This library is no exception, so use it with care. See https://securitypitfalls.wordpress.com/2018/08/03/constant-time-compare-in-python/ for more info.

Setup of Development Environment

python3 -m venv .venv
. ./.venv/bin/activate
pip install poetry
poetry install

Publishing a New Release

Since this project is considered critical on the Python Package Index, two-factor authentication is required. For uploading packages to PyPi, an API key is required; username+password will not work.

First, generate an API token at https://pypi.org/manage/account/token/. Then, use this token when publishing instead of your username and password.

As username, use __token__. As password, use the token itself, including the pypi- prefix.

See https://pypi.org/help/#apitoken for help using API tokens to publish. This is what I have in ~/.pypirc:

[distutils]
index-servers =
    rsa

# Use `twine upload -r rsa` to upload with this token.
[rsa]
  repository = https://upload.pypi.org/legacy/
  username = __token__
  password = pypi-token
. ./.venv/bin/activate
pip install twine

poetry build
twine check dist/rsa-4.9.tar.gz dist/rsa-4.9-*.whl
twine upload -r rsa dist/rsa-4.9.tar.gz dist/rsa-4.9-*.whl

The pip install twine is necessary as Python-RSA requires Python >= 3.6, and Twine requires at least version 3.7. This means Poetry refuses to add it as dependency.

Release files for rsa 4.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rsa 4.9
File Size Uploaded
rsa-4.9.tar.gz 29.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rsa 4.9
File Interpreter ABI Platform
rsa-4.9-py3-none-any.whl Python 3 none any Details

Total release size: 64.0 kB

Release files / rsa-4.9.tar.gz

Download URL rsa-4.9.tar.gz
Size 29.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21
BLAKE2b-256 checksum
How to use checksums
aa657d973b89c4d2351d7fb232c2e452547ddfa243e93131e7cfa766da627b52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / rsa-4.9-py3-none-any.whl

Download URL rsa-4.9-py3-none-any.whl
Size 34.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7
BLAKE2b-256 checksum
How to use checksums
4997fa78e3d2f65c02c8e1268b9aba606569fe97f6c8f7c2d74394553347c145
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release history Release notifications | RSS feed

This release

4.9 This release

2 release files

4.4

2 release files

4.1.1

1 release file

3.2.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page