Skip to main content

multisig HMAC

Project description

multisig-hmac-python-version

Multisig scheme for HMAC authentication

Work in progress

Installation

$ pip install multisig-hmac

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:

m = MultisigHMAC()

# generate keys which need to be stored securely and need to be shared securely with each party
k1 = m.keygen()
k2 = m.keygen()
k3 = m.keygen()

# sign by each client with 2-of-3
data = b'Hello world'

s1 = m.sign(k1, data)
s3 = m.sign(k3, data)

out = m.combine([s1, s3])

sent = (out[0], base64.urlsafe_b64encode(out[1]))

# --- network ---

received = (sent[0], base64.urlsafe_b64decode(sent[1]))

# verify on the server
threshold = 2
keys = [k1, k2, k3]
signature = received

m.verify(keys, signature, data, threshold)

Using a derived master key:

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()

k1 = m.keygen()
k2 = m.keygen()
k3 = m.keygen()

# sign by each client with 2-of-3
data = b'Hello world'

s1 = m.sign(k1, data)
s3 = m.sign(k3, data)

out = m.combine([s1, s3])

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
keys = [k1, k2, k3]
signature = received

m.verifyDerived(keys, signature, data, threshold)

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

Uploaded Source

Built Distribution

multisig_hmac-0.2.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file multisig-hmac-0.2.1.tar.gz.

File metadata

  • Download URL: multisig-hmac-0.2.1.tar.gz
  • Upload date:
  • Size: 3.2 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

Hashes for multisig-hmac-0.2.1.tar.gz
Algorithm Hash digest
SHA256 706a30049453ae0446cef1a555021ac74aad9d9185bc8772f688f83dd794a054
MD5 ae212aa6b98f78939b931f700e825c0b
BLAKE2b-256 8e6be9c3ca770b2183c4f3c23803128841c699676b4b3218bc0fbc0b832e8c82

See more details on using hashes here.

File details

Details for the file multisig_hmac-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: multisig_hmac-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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

Hashes for multisig_hmac-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b581e2d0af5809a4cfccafcc827697c88659dbb397cd69b90b14cb883c86eb2
MD5 fa5cf178e1ce5d549d394e5053a659a7
BLAKE2b-256 004f3b8b04f7a250ded9b3a008e4fa0ea8e26ee9c1996c32294f801aa2b76733

See more details on using hashes here.

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