Componentes adicionais de aplicativos clientes Confy
Project description
Confy Addons
Componentes adicionais de aplicativos clientes Confy.
A Python package that provides symmetric and asymmetric encryption functions for client applications of the Confy encrypted communication system, as well as prefixes that identify messages and encryption keys sent by applications during the handshake process. The package also includes functions to encode and decode the public RSA key to base64 for sending over the network.
Learn more about the project at github.com/confy-security
Made with dedication by students from Brazil 🇧🇷.
⚡ Using
Install the package
Install the package with the package manager used in your project.
For example, with pip:
pip install confy-addons
Or with Poetry:
poetry add confy-addons
Usage example
Import the necessary classes
from confy_addons import (
AESEncryption,
RSAEncryption,
RSAPublicEncryption,
deserialize_public_key,
)
This imports all the encryption classes and utilities needed for RSA and AES operations.
Generate an RSA key pair
rsa_handler = RSAEncryption()
private_key = rsa_handler.private_key
Creates a new RSA encryption handler that automatically generates a 4096-bit key pair. The private key is extracted for later decryption operations.
Serialize and share the public key
pub_key_b64 = rsa_handler.base64_public_key
deserialized_pub_key = deserialize_public_key(pub_key_b64)
The public key is serialized to a base64-encoded PEM format, which can be safely transmitted over text-based protocols. The deserialized version is reconstructed from the encoded string for encryption operations.
Create an RSA public encryption handler
rsa_public_handler = RSAPublicEncryption(key=deserialized_pub_key)
Initializes an RSA encryption handler using only the public key. This handler can encrypt data that only the holder of the private key can decrypt.
Generate and encrypt an AES key
aes_handler = AESEncryption()
encrypted_aes_key = rsa_public_handler.encrypt(aes_handler.key)
Generates a random 256-bit AES key and encrypts it using RSA public key encryption. This allows secure transmission of the symmetric key to the recipient.
Decrypt the AES key with the RSA private key
decrypted_aes_key = rsa_handler.decrypt(encrypted_aes_key)
aes_handler_decrypted = AESEncryption(key=decrypted_aes_key)
Decrypts the AES key using the RSA private key. A new AES handler is created with the decrypted key for symmetric encryption and decryption operations.
Encrypt and decrypt messages with AES
secret_message = "Secret message"
encrypted_message = aes_handler.encrypt(secret_message)
decrypted_message = aes_handler_decrypted.decrypt(encrypted_message)
print(decrypted_message)
Encrypts a plaintext message using AES-256 in CFB mode and then decrypts it back to verify the process works correctly. The output will display the original secret message.
Dependencies
Confy Addons relies only on cryptography.
License
Confy Addons is open source software licensed under the GPL-3.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 confy_addons-1.0.1.tar.gz.
File metadata
- Download URL: confy_addons-1.0.1.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e565ec5ef70e5f118566f7da8399192398a5354dd77358fca059d83e197fb17
|
|
| MD5 |
f19004b98e6e3c5068d16f1401e2b1e5
|
|
| BLAKE2b-256 |
a162c89f8fb3b0a6a0a8f16a4a75695d3d35357b863e8899d317ea290d285f4d
|
Provenance
The following attestation bundles were made for confy_addons-1.0.1.tar.gz:
Publisher:
publish.yml on confy-security/confy-addons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
confy_addons-1.0.1.tar.gz -
Subject digest:
1e565ec5ef70e5f118566f7da8399192398a5354dd77358fca059d83e197fb17 - Sigstore transparency entry: 629189546
- Sigstore integration time:
-
Permalink:
confy-security/confy-addons@6755e3655fb42d612efbba4873443ef48c8448a9 -
Branch / Tag:
refs/tags/1.0.1 - Owner: https://github.com/confy-security
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6755e3655fb42d612efbba4873443ef48c8448a9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file confy_addons-1.0.1-py3-none-any.whl.
File metadata
- Download URL: confy_addons-1.0.1-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
031599c867b309e449bfdb7f8f0465ed7d5690c46597908779d1335afe9202c9
|
|
| MD5 |
f68df169f8f0dc03331928119ef313ca
|
|
| BLAKE2b-256 |
096d64c26759b2748500db456e2bbbb06443625b6eee3b18f83c3f13e691a7c2
|
Provenance
The following attestation bundles were made for confy_addons-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on confy-security/confy-addons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
confy_addons-1.0.1-py3-none-any.whl -
Subject digest:
031599c867b309e449bfdb7f8f0465ed7d5690c46597908779d1335afe9202c9 - Sigstore transparency entry: 629189593
- Sigstore integration time:
-
Permalink:
confy-security/confy-addons@6755e3655fb42d612efbba4873443ef48c8448a9 -
Branch / Tag:
refs/tags/1.0.1 - Owner: https://github.com/confy-security
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6755e3655fb42d612efbba4873443ef48c8448a9 -
Trigger Event:
push
-
Statement type: