This is a thin wrapper on top of KSI C SDK. Experimental, non-supported code.
Synopsis
import ksi
import hashlib
# Instantiate service parameters from environment
KSI = ksi.KSI(**ksi.ksi_env())
# Sign a text string
sig = KSI.sign_hash(hashlib.sha256(b"Tere!"))
# Print some signature properties
print(sig.get_signing_time(), sig.get_signer_id())
# Now verify this text string, first obtaining a data hasher
h = sig.get_hasher()
h.update(b"Tere!")
print(KSI.verify_hash(sig, h))
# Obtain a binary blob which can be stored for long term
serialized_signature = sig.serialize()
# Some time have passed, fetch the signature and verify again
sig2 = KSI.parse(serialized_signature)
KSI.set_verification_policy(KSI.verification.POLICY_CALENDAR_BASED)
print(KSI.verify_hash(sig2, h))
Install
Requirements: Python 2.7+ or Python 3.1+. Jython, IronPython do not work.
Install fresh libksi aka KSI C SDK; see https://github.com/guardtime/libksi/
Install python-devel package
Run:
> python setup.py install
For development something like below is more appropriate:
> python setup.py build_ext --inplace
Using pip:
> pip install git+https://github.com/GuardTime/ksi-python.git
Library can be packaged as a binary rpm:
> python setup.py bdist_rpm
etc.
Tests
> python setup.py test
Documentation
http://guardtime.github.io/ksi-python/
Type:
> pydoc ksi
to read the documentation after installation. Generating html or pdf documentation: make sure that dependencies like sphinx (pip install sphinx) are installed and run:
> cd docs > make html > make latexpdf
License
Apache 2.0. Please contact Guardtime for supported options.
Metadata
Release files for ksi-python 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ksi-python-0.3.1.tar.gz | 12.9 kB | Details |
Release files / ksi-python-0.3.1.tar.gz
| Download URL | ksi-python-0.3.1.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e5b7b2283f7e2dada20b95e894a1f58ab86bbc87cb529bd2b1aa29d48639e64
|
|
BLAKE2b-256 checksum How to use checksums |
d500b95de25d670eb5f5ac496250486883e4471e118ec89e2837f1edd718268d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |