Skip to main content

PyGLOME

This is not an officially supported Google product.

This repository contains a Python implementation for the GLOME protocol. You can find the library in the folder pyglome. The test files can be found in the test folder.

Python API

Requirements

  • Python >= 3.6
  • pyca/cryptography >= 2.5

Example

We provide a brief example of use. In order for Alice and Bob to communicate, the first step would be to generate some new keys:

import pyglome

alice_keys = pyglome.generate_keys()
bob_keys = pyglome.generate_keys()

Suppose that Alice knows Bob's public_key and wants to send Bob the message msg and no other message have been shared before. Alice will need to:

glome = pyglome.Glome(bob_keys.public, alice_keys.private)
first_tag = glome.tag(msg, counter=0)

And Alice will send Bob both msg, first_tag as well as Alice's public key. On Bob's end he will need to do the following:

glome = pyglome.Glome(alice_keys.public, bob_keys.private)
try:
    glome.check(first_tag, msg, counter=0)
except pyglome.TagCheckError as tag_error:
    ## Handle the exception.
## do what you have to do

Key generation.

Should you want to use a preexisting key, it should match the format X25519Private/PublicKey provided in pyca/cryptography. Such a key can be easily read from a bytes object as follows:

from cryptography.hazmat.primitives.asymmetric import x25519
my_private_key = x25519.X25519PrivateKey.from_private_bytes(private_key_bytes)
my_public_key = x25519.X25519PublicKey.from_private_bytes(public_key_bytes)

We provide a key generation function generate_keys that uses these methods to create a new key pair from os.urandom bytes.

Documentation

For more information see the in-code documentation.

Test

In the test folder we have scripts that implement test classes based on unittest. To run all tests use:

python -m test

from this directory. If you only want to execute a particular test module, then run:

python -m test.my_module_name

where my_module_name is the name of the test module to be executed (the name of the file without the .py).

Release files for pyglome 0.0.2

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

Source distribution (sdist)

Source distribution for pyglome 0.0.2
File Size Uploaded
pyglome-0.0.2.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyglome 0.0.2
File Interpreter ABI Platform
pyglome-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / pyglome-0.0.2.tar.gz

Download URL pyglome-0.0.2.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2114d14baea6a2b61ccdbbbe3a122204d73c8111d9dd4830537887b122f45cb6
BLAKE2b-256 checksum
How to use checksums
ca1c93787f5189d545fafaa9430353d09dcbe689e439b901cc2c6d12c701deec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.3

Release files / pyglome-0.0.2-py3-none-any.whl

Download URL pyglome-0.0.2-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4efaaa2017e1fd47d3f9dd90c87a422cc14bfe7b0bcc97da3fbcae39cec3bf1d
BLAKE2b-256 checksum
How to use checksums
1f8f05e854e3df6919b9aa9660c5c66362583ac1d51f51605532919b3972715b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.5.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

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