Skip to main content

Public key secure transport layer

Project description


Python 3 bindings for Rust PKSTL. PKSTL is a security layer for network connections (public key cryptography & Diffie-Hellman secret generation).


sudo pip3 install pkstl

Build & install

sudo pip3 install --upgrade setuptools wheel
sudo pip3 install target/wheel/dist/pkstl-*-py3-none-any.whl


Run an example (client-server echo):

python3 py/ server
python3 py/ client
# and type some text into the client!

Minimal example code: (Bob knows Alice's public key and contacts her)

import pkstl

# Generate keypairs
alice_seed = pkstl.Seed32.random() # Alice's permanent private key
alice_pubkey = pkstl.Ed25519KeyPair.from_seed_unchecked(alice_seed.bytes).pubkey
bob_seed = pkstl.Seed32.random() # Bob's ephemeral private key
alice_msl = pkstl.SecureLayer.create(pkstl.SecureLayerConfig.default(), alice_seed)
bob_msl = pkstl.SecureLayer.create(pkstl.SecureLayerConfig.default(), bob_seed, alice_pubkey)

# Establish connection
msg = bob_msl.write_connect_msg_bin(b"Hello Alice!")

msg = alice_msl.write_connect_msg_bin(b"Hello Bob!")

msg = alice_msl.write_ack_msg_bin(b"Nice to meet you Bob!")

msg = bob_msl.write_ack_msg_bin(b"Nice to meet you Alice!")

# Send messages
msg = alice_msl.write_bin(b"Is this channel encrypted?")

msg = bob_msl.write_bin(b"Yes it is.")

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pkstl-0.1.0-py3-none-any.whl (1.0 MB view hashes)

Uploaded py3

Supported by

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