Skip to main content

Library for UPSS

Project description

UPSS — Secure Communication Protocol Library for Python

UPSS is a lightweight, security-first Python library implementing the UPSS protocol — a custom communication protocol designed with end-to-end encryption, secure session handling, and structured message exchange over TCP sockets.

Built for developers who prioritize data confidentiality and integrity, UPSS abstracts low-level socket programming while enforcing cryptographic best practices out of the box.


🔐 Key Features

  • Mandatory encryption: All payloads are encrypted using symmetric cryptography (cryptography).
  • Route-based request handling: Decorator-style endpoint registration.
  • Structured data model: Messages are encapsulated in typed Package objects with status, type, and payload.
  • Client & server utilities: Full-stack support with minimal boilerplate.

🚀 Quick Start

Installation

pip install upss-py

Server Example

from upss import UPSS
from upss.models import Status
from upss.security import cryptographer

app = UPSS(
    addr="localhost",
    port=1234,
    encoding="utf-8"
)


# Example handle "/" 
@app.url("/")
def auth_handler(client, encoding, key, data):
    print(cryptographer.decrypt_data(data["msg"], encoding, key))  # Hello Server!!!
    return Status.ok  # Return OK


if __name__ == "__main__":
    app.run()

Client Example

from cryptography.fernet import Fernet
from upss import client
from upss.models import Package, Types
from upss.security import cryptographer

key = Fernet.generate_key()

data = {
    "msg": cryptographer.encrypt_data("Hello Server!!!", "utf-8", key)
}

# Connect to "/"
for connection in client.connect("upss://localhost:1234", encoding="utf-8", key=key):
    connection.send(Package("/", Types.SEND, data))  # Send `Hello Server!!!`
    print(connection.get())  # Server said: OK

🔒 Security Model

Symmetric encryption only: keys are automatically transmitted via a handshake. The protocol requires constant updating of encryption keys. Plaintext is not allowed: the protocol assumes that all data fields are encrypted;

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

upss_py-0.0.2.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

upss_py-0.0.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file upss_py-0.0.2.tar.gz.

File metadata

  • Download URL: upss_py-0.0.2.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for upss_py-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c29d87fcd146ac1c9aeea0e94968165f45d0e03f76dfeb10a149c12fe1f4c7bc
MD5 f367fa5e67e93de0cf83dee9515c0051
BLAKE2b-256 b7048e395bafb244eb6765076c6c7437dc708ebdb3f3e064ecca68b76804a787

See more details on using hashes here.

File details

Details for the file upss_py-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: upss_py-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for upss_py-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6598672d10718ce6a3e698489793192b68ebe4654379a9bba16a64189418dcca
MD5 f347c95bcf61a0d9ebafe027a45ac6cf
BLAKE2b-256 b9a182249b224ba6207244c6ee3f310a55efa39e9ad04eb2de2810e54cbc6d98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page