Registry / auth-security / lightdsa

lightdsa

JSON →
library0.0.3pypypi✓ verified 85d ago

LightDSA (version 0.0.3) is a lightweight Python library providing Digital Signature Algorithm functionalities. Currently, it primarily supports the RSA algorithm for generating keys, signing data, and verifying signatures. Its development appears to be inactive since 2021, and new releases are infrequent.

pip install lightdsa
INSTALL
IMPORT
SIG · LIGHTDSA
L
lightdsa
auth-securitypythonv0.0.3
Install
6.4s avg
Import
963ms
Disk
89MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.990s · 79.1MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 6.4s · import 0.936s · 80MB
89MB installed
● package 89MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LightDSA
from lightdsa import LightDSA

This quickstart demonstrates how to generate RSA keys, sign a message, and verify the signature using the `LightDSA` class. It also shows how to load keys from PEM format.

from lightdsa import LightDSA # 1. Generate keys # For RSA, key_size must be between 1024 and 4096 (inclusive) # and a multiple of 256. dsa = LightDSA(key_size=2048) # Default is 2048 private_key_pem = dsa.private_key_to_pem().decode('utf-8') public_key_pem = dsa.public_key_to_pem().decode('utf-8') print("Private Key (PEM format):") print(private_key_pem) print("\nPublic Key (PEM format):") print(public_key_pem) # 2. Sign data message_to_sign = "This is a secret message." signature = dsa.sign(message_to_sign.encode('utf-8')) print(f"\nMessage: {message_to_sign}") print(f"Signature: {signature.hex()}") # 3. Verify signature using the current object's keys is_valid = dsa.verify(message_to_sign.encode('utf-8'), signature) print(f"Signature valid: {is_valid}") # You can also load keys from PEM strings into a new LightDSA instance dsa_loaded = LightDSA(key_size=2048) # key_size required for initialization dsa_loaded.load_public_key_from_pem(public_key_pem.encode('utf-8')) dsa_loaded.load_private_key_from_pem(private_key_pem.encode('utf-8')) # Optional for verification is_valid_loaded = dsa_loaded.verify(message_to_sign.encode('utf-8'), signature) print(f"Signature valid (loaded keys): {is_valid_loaded}")
Debug
Known issues
gotchaThe LightDSA library appears to be unmaintained. The last commit on GitHub was in 2021, and the version 0.0.3 suggests early development. Users should be aware that it may not receive future updates or security fixes.
fix
Consider alternatives for actively maintained cryptographic libraries in production environments, such as `cryptography`.
affects: <=0.0.3
gotchaDespite its name, LightDSA currently only supports the RSA algorithm for digital signatures. The `key_size` parameter is specifically for RSA key lengths.
fix
Do not expect support for other DSA algorithms like ECDSA. If you require other signature types, use a more comprehensive library like `cryptography`.
affects: <=0.0.3
gotchaLightDSA relies on the `pycryptodome` library. Incorrect or incomplete installation of `pycryptodome` (which might require C build tools on some systems) can lead to runtime errors.
fix
Ensure `pycryptodome` is correctly installed: `pip install pycryptodome`. If you encounter build errors, consult `pycryptodome`'s documentation for platform-specific dependencies.
affects: <=0.0.3
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'Crypto'
The `lightdsa` library uses `pycryptodome` internally, which often exposes its modules under the `Crypto` namespace. This error indicates `pycryptodome` is not installed.
fix
Install the `pycryptodome` package: `pip install pycryptodome`.
TypeError: object of type 'str' has no len()
Cryptographic functions for signing and verification expect byte-like objects (e.g., `bytes`), not strings. You are likely passing a Python `str` directly.
fix
Convert your string data to bytes before passing it to `sign()` or `verify()`. For example, `my_string.encode('utf-8')`.
Upgrade
Version history
0.0.3latest on PyPI · released Apr 1, 2025
Audit
Dependencies
pycryptodomerequiredProvides core cryptographic primitives for key generation, signing, and verification.
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
lightdsa — pip install lightdsa · libregistry