multisig HMAC
Project description
multisig-hmac-python-version
Multisig scheme for HMAC authentication. Python implementation of multisig-hmac.
Work in progress
Usage
Key management can happen in either of two modes, either by storing every of the component keys, or by storing a single master seed and using that to derive keys ad hoc.
Using stored keys:
from multisig_hmac.multisig_hmac import MultisigHMAC
import base64
m = MultisigHMAC()
# generate keys which need to be stored securely and need to be shared securely with each party
k0 = m.keygen(0)
k1 = m.keygen(1)
k2 = m.keygen(2)
# sign by each client with 2-of-3
data = b'hello world'
s0 = m.sign(k0, data)
s2 = m.sign(k2, data)
# combine the used signatures
out = m.combine([s0, s2])
sent = (out[0], base64.urlsafe_b64encode(out[1]))
# --- network ---
received = (sent[0], base64.urlsafe_b64decode(sent[1]))
# verify on the server
threshold = 2
keys = [k0, k1, k2]
signature = received
m.verify(keys, signature, data, threshold)
Using a derived master key:
from multisig_hmac.multisig_hmac import MultisigHMAC
import base64
m = MultisigHMAC()
# generate a master seed which needs to be stored securely
# this seed must NOT be shared with any other party
seed = m.seedgen()
k0 = m.deriveKey(seed, 0)
k1 = m.deriveKey(seed, 1)
k2 = m.deriveKey(seed, 2)
# sign by each client with 2-of-3
data = b'hello world'
s0 = m.sign(k0, data)
s2 = m.sign(k2, data)
# combine the used signatures
out = m.combine([s0, s2])
sent = (out[0], base64.urlsafe_b64encode(out[1]))
# --- network ---
received = (sent[0], base64.urlsafe_b64decode(sent[1]))
# verify on the server, but now keys are dynamically derived
threshold = 2
signature = received
m.verifyDerived(seed, signature, data, threshold)
Installation
$ pip install multisig-hmac
Running tests
$ pip install -U pytest
$ py.test
License
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
multisig-hmac-0.2.2.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file multisig-hmac-0.2.2.tar.gz
.
File metadata
- Download URL: multisig-hmac-0.2.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3716ff89465be51107eff83d53ce54c22ad6a3332084fa09dea93037e27b7e05 |
|
MD5 | 6d9c972d52ae5a57a6df40541bc6e932 |
|
BLAKE2b-256 | 208042923a9b3ca02ba9061291a04a34f54e95a2336de37664e81c25eed1918d |
File details
Details for the file multisig_hmac-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: multisig_hmac-0.2.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d12dc34a8078b0048607af9daead184a0946f602e87d984e88a09f7b43189366 |
|
MD5 | 0e556007fb50553eb76d116cfb90e41b |
|
BLAKE2b-256 | a4b00e1355e4425c4e293525a8b3e5932c76c1b745bbb67697ab03bc60c7a166 |