Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matrix-org/python-signedjson
Sign JSON objects with ED25519 signatures
https://github.com/matrix-org/python-signedjson
Last synced: 9 days ago
JSON representation
Sign JSON objects with ED25519 signatures
- Host: GitHub
- URL: https://github.com/matrix-org/python-signedjson
- Owner: matrix-org
- License: apache-2.0
- Created: 2015-08-24T13:42:16.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2022-09-23T15:01:50.000Z (about 2 years ago)
- Last Synced: 2024-08-01T13:37:48.872Z (3 months ago)
- Language: Python
- Size: 50.8 KB
- Stars: 11
- Watchers: 22
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
Signed JSON
===========.. image:: https://img.shields.io/pypi/v/signedjson.svg
:target: https://pypi.python.org/pypi/signedjson/
:alt: Latest Version.. image:: https://img.shields.io/travis/matrix-org/python-signedjson.svg
:target: https://travis-ci.org/matrix-org/python-signedjsonSigns 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
----------.. code:: bash
pip install signedjson
Using
-----.. code:: python
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
------.. code:: json
{
"": "",
"signatures": {
"": {
"ed25519:": ""
}
},
"unsigned": {
"": "",
}
}