Skip to main content

Installation

pip install -U xrypt-xethhung12

Usage

from xrypt_xethhung12.rsa_encryption import gen_key_pair, read_public_key_from_pem_str, read_private_key_from_pem_str
from xrypt_xethhung12.rsa_format import pub_key_to_pem, pri_key_to_pem
from xrypt_xethhung12.xrypt.xrypt import DeEnCryptor, Signer, Verifier

if __name__ == '__main__':
    # Generate key pair
    s_pub, s_pri = gen_key_pair()
    r_pub, r_pri = gen_key_pair()

    # encrypt and decrypt
    data_encrypted = DeEnCryptor(s_pub, s_pri).encryptToContainer(r_pub, "helloworld")
    data = DeEnCryptor(r_pub, r_pri).decryptContainer(s_pub, data_encrypted)
    print(data)

    # sign and verify
    signed_data = Signer(s_pri).sign("helloworld")
    print(Verifier(s_pub).verify(signed_data))

    # To pem format string
    print(pub_key_to_pem(s_pub))
    print(pri_key_to_pem(s_pri))

    reloaded_s_pub_key = read_public_key_from_pem_str(pub_key_to_pem(s_pub))
    reloaded_s_pri_key = read_private_key_from_pem_str(pri_key_to_pem(s_pri))
    reloaded_r_pub_key = read_public_key_from_pem_str(pub_key_to_pem(r_pub))
    reloaded_r_pri_key = read_private_key_from_pem_str(pri_key_to_pem(r_pri))

    # encrypt and decrypt - again
    data_encrypted = DeEnCryptor(reloaded_s_pub_key, reloaded_s_pri_key).encryptToContainer(reloaded_r_pub_key, "helloworld")
    data = DeEnCryptor(reloaded_r_pub_key, reloaded_r_pri_key).decryptContainer(reloaded_s_pub_key, data_encrypted)
    print(data)

    # sign and verify - again
    signed_data = Signer(reloaded_s_pri_key).sign("helloworld")
    print(Verifier(reloaded_s_pub_key).verify(signed_data))

Scripts

Generate rsa key pair

pri={pri}
pub={pub}
openssl genrsa -out $pri 4096
openssl rsa -in $pri -outform PEM -pubout -out $pub

Build

rm -fr dist
python3 -m build

Build and Deploy

rm -fr dist
python3 -m build
twine upload dist/* -u __token__ -p $pwd

Update version dev

python3 -m xh_py_project_versioning --patch

Update version

python3 -m xh_py_project_versioning --patch -d

Metadata

Release files for xrypt-xethhung12 0.0.10

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

Source distribution (sdist)

Source distribution for xrypt-xethhung12 0.0.10
File Size Uploaded Provenance Actions
xrypt-xethhung12-0.0.10.tar.gz 4.6 kB Without provenance Details for xrypt-xethhung12-0.0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xrypt-xethhung12 0.0.10
File Interpreter ABI Platform Actions
xrypt_xethhung12-0.0.10-py3-none-any.whl Python 3 none any Details for xrypt_xethhung12-0.0.10-py3-none-any.whl

Total release size: 9.8 kB

Release files / xrypt-xethhung12-0.0.10.tar.gz

Download URL xrypt-xethhung12-0.0.10.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b9cdf2d091f9aceebf3a5918bdfc19aa6ea566d3a320cbb4c27d1be8d04f63a8
BLAKE2b-256 checksum
How to use checksums
322797650b579154e234c7968feb66b9e0d61863d8bd991e221f54a3549ca976
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / xrypt_xethhung12-0.0.10-py3-none-any.whl

Download URL xrypt_xethhung12-0.0.10-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eed0ee736e3bf7c6a2fa90291bc88d1a60e0d3f1b75955ff435c0656de0eb10d
BLAKE2b-256 checksum
How to use checksums
50686e6eaf193c9693fc5a8a87fe3800d8286f6d317ae166af21a54330fc2a3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for xrypt-xethhung12 0.0.10

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.

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