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.3.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

signedjson-1.1.3-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: signedjson-1.1.3.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for signedjson-1.1.3.tar.gz
Algorithm Hash digest
SHA256 14f4f6f5eb307c2a3ab76e28f8bd317ab67ce100457b73a520970e468b84af5b
MD5 4c74eafa53fab359286000d084fe6bc5
BLAKE2b-256 a2528727ef3462f4a2eec4c47f0311fe04496aebe02f5487e969659cf0c1da62

See more details on using hashes here.

Provenance

File details

Details for the file signedjson-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: signedjson-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for signedjson-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9b71aaac69de6467452cfb07c2b473e6b536772ad8765c1bcc778847bb23b073
MD5 4649b3bd66ac55556051266038b9e98e
BLAKE2b-256 d24d39e49395da2d7787aa70d4d3c0ac29ab7f89ac9675d17ab3c72fe3eb76ed

See more details on using hashes here.

Provenance

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