Skip to main content

Sign JSON with Ed25519 signatures

Project description

Latest Version https://img.shields.io/travis/matrix-org/python-signedjson.svg

Signs JSON objects with ED25519 signatures.

Features

  • More than one entity can sign the same object.

  • Each entity can sign the object with more than one key making it easier to rotate keys

  • ED25519 can be replaced with a different algorithm.

  • Unprotected data can be added to the object under the "unsigned" key.

Installing

pip install signedjson

Using

from signedjson.key import generate_signing_key, get_verify_key
from signedjson.sign import (
    sign_json, verify_signed_json, SignatureVerifyException
)

signing_key = generate_signing_key('zxcvb')
signed_json = sign_json({'my_key': 'my_data'}, 'Alice', signing_key)

verify_key = get_verify_key(signing_key)

try:
    verify_signed_json(signed_json, 'Alice', verify_key)
    print 'Signature is valid'
except SignatureVerifyException:
    print 'Signature is invalid'

Format

{
    "<protected_name>": "<protected_value>",
    "signatures": {
        "<entity_name>": {
            "ed25519:<key_id>": "<unpadded_base64_signature>"
        }
    },
    "unsigned": {
        "<unprotected_name>": "<unprotected_value>",
    }
}

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

signedjson-1.1.tar.gz (10.1 kB view details)

Uploaded Source

File details

Details for the file signedjson-1.1.tar.gz.

File metadata

  • Download URL: signedjson-1.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9

File hashes

Hashes for signedjson-1.1.tar.gz
Algorithm Hash digest
SHA256 bbbce17b9aceebfbb7e22694231d98fb03b78de8159eafbb9168fccf41898e8f
MD5 60730931c73510d5d40a46944d9fa9f7
BLAKE2b-256 57ee2d554d67ddd4ab63d248a2c140f3c41e49cba4f685dfe78d8eb169b24483

See more details on using hashes here.

Supported by

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