crypto-licensing

The crypto-licensing module implements Ed25519-signed license checking and automatic issuance after cryptocurrency payment


Keywords
licensing, Bitcoin, Ethereum, cryptocurrency, payments, Ed25519, signatures
License
NRL
Install
pip install crypto-licensing==1.0.0

Documentation

Cryptographically Signed License Issuance with Payment in Cryptocurrency

Software Licensing Using Ed25519 Signatures

Issuing A License

To begin authoring Licenses, you need to be able to sign them. Create and save an encrypted Ed25519 keypair.

authoring: Creating an Authoring Keypair

The raw ed25519.Keypair from authoring isn’t serializable, so get a crypto_licensing KeypairEncrypted and save its str( <KeypairEncrypted> ) output to a file.

import crypto_licensing as cl
username		= 'admin@awesome-inc.com'
password		= 'password'
auth_keypair	= None or cl.authoring( seed=b'\xff' * 32 ) # don't do, unless you have a random seed!
encr_keypair	= cl.KeypairEncrypted( auth_keypair, username=username, password=password )
decr_keypair	= cl.KeypairPlaintext( encr_keypair.into_keypair( username=username, password=password ))
[
    [ "Plaintext:", "" ],
    [ "verifying", decr_keypair['vk'] ],
    [ "signing", decr_keypair['sk'] ],
    [ "Encrypted:" ],
    [ "salt", encr_keypair['salt'] ],
    [ "ciphertext", encr_keypair['ciphertext'] ],
]
0 1
Plaintext:
verifying dqFZIESm5PURJlvKc6YE2QsFKdHfYCvjChmpJXZg0fU=
signing //////////////////////////////////////////92oVkgRKbk9REmW8pzpgTZCwUp0d9gK+MKGakldmDR9Q==
Encrypted:
salt 156dd79ff272ee57eca219eb
ciphertext 4aa6a946a22eb4444064d115286c352469a4e7ebdf41a61c2d31e68e1652f4917926b4a6910b5a9e48a3e74cd332a739

register: Create and save an Authoring Keypair

issue: Signing a License

A License can be as simple, free-standing authorization with no other License dependencies, or it may have a tree of sub-Licenses that must also be confirmed as valid.

verify: Confirm License (and sub-License) Validity

Using Licenses

load_keys: Find all Ed25519 Signing Keys

load: Find all Licenses

check: Find all Keys and Valid Licenses

Loads every available Ed25519 Keypairs (with the provided credentials), and all available Licenses, yielding all <Keypair>,<LicenseSigned> that are valid in the current environment.

If no valid License is available for some key found, then <Keypair>,None is yielded, allowing the caller to use the Key to issue a License if desired.

If nothing at all is yielded, then this indicates that no Keypairs were found; either you need to “register” (create and save) one, or provide different credentials.

Running A crypto_licensing.licensing Server

Supply the username and password to the KeypairEncrypted via environment variables CRYPTO_LIC_USERNAME and CRYPTO_LIC_PASSWORD.

Payment with Cryptocurrencies

Issuance via Web API