Python bindings for rsca library
Project description
PyRSCA
Python bindings for the RSCA (Rust Signature and Certificate Authority) library.
Development with uv
This project is managed using uv, a fast Python package manager.
Prerequisites
-
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
-
Install Rust (if not already installed):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Quick Start
-
Setup development environment:
cd pyrsca uv sync --dev
-
Activate virtual environment:
source .venv/bin/activate
-
Build the extension:
uv run maturin develop
-
Run tests:
uv run pytest
Development Workflow
-
Install dependencies:
uv add --dev <package-name>
-
Build for development:
uv run maturin develop --release
-
Build wheels:
uv run maturin build --release
-
Publish (when ready):
uv run maturin publish
Project Structure
src/lib.rs- Rust source code with Python bindingspyrsca/- Python package sourcetests/- Python testspyproject.toml- Project configuration and dependenciesCargo.toml- Rust dependencies and build configuration
Available Commands
Using uv directly:
uv sync- Install all dependenciesuv run pytest- Run testsuv run maturin develop- Build and install in development modeuv run maturin build- Build distribution wheelsuv add <package>- Add a new dependencyuv remove <package>- Remove a dependency
Using the development script (recommended):
The dev.sh script handles environment conflicts and provides convenient commands:
./dev.sh sync- Install/update dependencies./dev.sh dev- Build in development mode./dev.sh build- Build release mode./dev.sh test- Run tests./dev.sh clean- Clean build artifacts./dev.sh install- Install package in editable mode./dev.sh help- Show help
Note: The development script automatically handles conda/uv environment conflicts.
Python Version Management
This project supports Python 3.7+ and uses Python 3.11 by default. You can change this by:
-
Update
.python-version:echo "3.12" > .python-version
-
Recreate virtual environment:
uv sync --reinstall
Features
- PyTWCA: Python wrapper for TWCA certificate operations
- uni_sign: Unified signature function supporting both PKCS1 and PKCS7 formats
- PKCS7 Signature: PKCS7 signature with unified output format
- PKCS1 Signature: PKCS1 signature with base64 encoded data and certificate
- PySignType: Enum for selecting signature type (Pkcs1, Pkcs7)
- Certificate operations: Extract certificate information and base64 encoding
Signature Output Format
Both PKCS1 and PKCS7 signatures use a unified output format:
{type}.{signature_base64}.{data_base64}.{cert_base64}
- PKCS1:
pkcs1.{signature_base64}.{data_base64}.{cert_base64} - PKCS7:
pkcs7.{signature_base64}.{data_base64}.{cert_base64}
Usage Example
from pyrsca import PyTWCA, PySignType
# Initialize TWCA instance
twca = PyTWCA("/path/to/cert.pfx", "password", "192.168.1.1")
# Get certificate person ID
person_id = twca.get_cert_person_id()
print(f"Certificate Person ID: {person_id}")
# Unified signature function (recommended)
pkcs1_result = twca.uni_sign("data to sign", PySignType.Pkcs1)
pkcs7_result = twca.uni_sign("data to sign", PySignType.Pkcs7)
print(f"PKCS1 Result: {pkcs1_result}")
print(f"PKCS7 Result: {pkcs7_result}")
# Direct signature methods
pkcs1_result = twca.sign_pkcs1("data to sign")
pkcs7_result = twca.sign_pkcs7("data to sign")
# Legacy PKCS7 signature (URL encoded, different format)
legacy_signature = twca.sign("data to sign")
# Get base64 encoded certificate
cert_base64 = twca.get_cert_base64()
print(f"Certificate Base64: {cert_base64}")
# Check expiration
expire_timestamp = twca.get_expire_timestamp()
print(f"Certificate expires at: {expire_timestamp}")
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrsca-0.4.0.tar.gz.
File metadata
- Download URL: pyrsca-0.4.0.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0608ef8fdfc18123efcdaa180bea35d587f59892a574badca88f6be862f5870
|
|
| MD5 |
93cb5e4a6334eba6cd77fdf0cddd0185
|
|
| BLAKE2b-256 |
24459fa67d8e175b5014b7fe9e10b368cde91651bc84f59fd902e471474251bd
|
File details
Details for the file pyrsca-0.4.0-cp314-cp314t-win_amd64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp314-cp314t-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.14t, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ceb96ecb2953b81de368c132ef88729d9e738fdee8aed55faa53d3226c53b72
|
|
| MD5 |
8a4038063d2e01d16306acbaa0405781
|
|
| BLAKE2b-256 |
0e9f6c10fbc50f1a2c4f9702d746d0c502b6b03abf5a211e2d846dda237616c8
|
File details
Details for the file pyrsca-0.4.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.14t, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e37622bb7479500eb412bb55e7f0839bb983edcd1e52145f5c3576f274c3d9ed
|
|
| MD5 |
c79d86900c501dbcffa3a232117076f8
|
|
| BLAKE2b-256 |
e213f0085114d3d324ed6559a13378eaa3b40f84191752e4c35c2014cdf452b2
|
File details
Details for the file pyrsca-0.4.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.14t, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8240cd44f6afff7adb7fc5c10022ef99ff1ce21218fb66ad51eb58c8d3fabb71
|
|
| MD5 |
723c1dec0afd2c867c9be5fd4e834196
|
|
| BLAKE2b-256 |
7d2684c4dcaca9d720ecb17935b50d2fac0e9cf54b14494f27bb75a3b199ba15
|
File details
Details for the file pyrsca-0.4.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.14t, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21e6a598e33f382ad23a878136fa744f329e097b487d940c8c3b340b4c9509a1
|
|
| MD5 |
8ddfb280ae1e8ada72ce92948fcd7fa3
|
|
| BLAKE2b-256 |
9883aa293c853a6f9bc2412a7ec19e31a9f4c3d35be3486f92dacd2047b45ce6
|
File details
Details for the file pyrsca-0.4.0-cp314-cp314t-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp314-cp314t-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.14t, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
302e1780fa0e903f1018f0be720e4dbc64396d55f08529bd120057661fcd0ee9
|
|
| MD5 |
54dcd8772c463ad8c9f4d627e2a4a740
|
|
| BLAKE2b-256 |
f3e1bcb63e29ca967ce19bbc7602c096b522c9f563c991ad4b741fdff83c2a48
|
File details
Details for the file pyrsca-0.4.0-cp314-cp314t-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp314-cp314t-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.14t, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89d660251ea24e29cf33dd2fcc5a4d6290ec2eb630fb1d0efddfcb6f94d3125c
|
|
| MD5 |
dd0cdd671fae8b924a5d1a887a6231bb
|
|
| BLAKE2b-256 |
6b08267897d171e075ee4a76aca461c26b2102e86e6585dfe5a407a19c01df6a
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b97035473a06531c5f05833b37911dc095425abae35b7209c22b5d41ff5c09c
|
|
| MD5 |
24a1688731c0d070399990995a54ddcb
|
|
| BLAKE2b-256 |
37030db75110607053d2626ff52c9a0ceeda9119f08499a1a9c5cd51ec0a33e6
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-win32.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-win32.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.7+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aeb63fa35bd656b383b47f71472b95d52dc527f433ca31ce02697fe7ade39c7
|
|
| MD5 |
3b849a5559dd3e347ecf72cff6b0c494
|
|
| BLAKE2b-256 |
5c714472263d8705c09481967dca6856f1c4063e270045b10e4b6b7070d792b1
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
811afeb8707b7cebb0179acf68d19a64bc293310bb414badde7293ec2d5da694
|
|
| MD5 |
21729379132849e456f825b2f0c1d657
|
|
| BLAKE2b-256 |
9ecb7c7c3418e4553d63ef5f3eb6cccb222b9a97c3459665a225f06839f29704
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be6ccdbe328302b0ab3134c4b41097b5e032a2ce95a0a307c0af31d98905ceec
|
|
| MD5 |
60befd4dedb57aa242bcbf107050bcdb
|
|
| BLAKE2b-256 |
67d9a9867005f3ddaa1f76210fe311b813048ac74a57ee5a36fc03a7981708ae
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d404dc69be0c28cec7a66ee9842833d80ddd4e5af662532c51a596b0089f4ee2
|
|
| MD5 |
0e8e1bf388c04976838221a4189301c3
|
|
| BLAKE2b-256 |
2ad6b8a3a77cb8eeacf887517ae6697d35c92a137cd577e4116180136f4b8001
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02c03f1fd809b2e7720e4e549ff493bba8793a491644513efa5582a3c77615b9
|
|
| MD5 |
1bac31c3db919e18fd05bd34187de4b9
|
|
| BLAKE2b-256 |
1a8e93b11d3c299e3ffaac35257fe7db81ea180056c52371a959743ed0ac9a68
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3843ef87f5808d256ce78ea676255aa97dc788a7b2ccb39970b7be0be553b2b5
|
|
| MD5 |
72c4240fed93ffbf06221cd1eb4b5964
|
|
| BLAKE2b-256 |
a6f3c160bb8b5d76e981525b5d8ca0b71021f096ad4f446f9a4c4d7ed7a9a4ed
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dc266566e87968b880810bc7e581487d02d01034577adca434a37a195e7b0f0
|
|
| MD5 |
3c301b4255c35e944f1378c1a726e308
|
|
| BLAKE2b-256 |
d358a36e77522b4babc5a41253d70b7c954d428ccb0dd1041cbbeb3d09d64ea7
|
File details
Details for the file pyrsca-0.4.0-cp37-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pyrsca-0.4.0-cp37-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.7+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccb6913cc7c16f2576aa3366cef83106725879bf237c263a6e690a2f2879c82e
|
|
| MD5 |
613a72dea0dda0579c6c6ad06bbfd422
|
|
| BLAKE2b-256 |
352754eb2d023f7db4a780af8e6f1856143d0e21cd3340c9602f7d6dbf5bc748
|