Elite v1.1.1
A lightweight module for elliptic-curve security schemes.
Repository: https://github.com/origamizyt/Elite
1. Installation
This module is available on PyPI, which you can install by running the command below:
pip install Elite
The source code is also available on Github.
2. Usage
2.1 Concepts
There are a few concepts you need to know before coping with this module. Otherwise you may get lost in the usage and description. You'll need to you what is a:
- Scheme. A security scheme is an object which encapsulates the standard procedures in its methods and provides simple interfaces to operate with.
- Cryptography Provider. A crypto provider is an instance which manages the symmetric algorithm part of the scheme.
2.2 Basic usage
For top-level functionalities, you can instantiate an instance of a scheme either by calling getscheme or directly create an instance. However, it's recommended that beginners use the getscheme method:
import elite
# server side
s = elite.getscheme()
# client side
c = elite.getscheme()
After instantiating a scheme, you can export your local public key or import remote key by calling the following methods:
# binary version
c.importBinaryKey(s.exportBinaryKey())
# hex version
s.importHexKey(c.exportHexKey())
After loading the keys, a shared secret should now be established. Call the secret method to generate a shared secret. The two secrets should be the same.
# should be the same
print(s.secret())
print(c.secret())
Sign / Verify data via the sign / verify method:
signature = s.sign(b'data')
assert c.verify(b'data', signature)
Encrypt / Decrypt data via the encrypt / decrypt method:
data = s.encrypt(b'data')
assert b'data' == c.decrypt(data)
NOTE: a scheme can only verify / decrypt data from the other side. Don't try to verify / decrypt data generated by yourself.
2.3 Advanced usage
For mid-level programmers, you could try instantiating the schemes directly. They are in the scheme submodule.
from elite.scheme import P384r1AesGcmScheme
# secp384r1 with AES_GCM
s = P384r1AesGcmScheme()
c = P384r1AesGcmScheme()
For high-level programmers, you can instantiate the ECCScheme class to create your own schemes:
from elite.scheme import ECCScheme
from elite.cipher import getprovider
from elite.secret import CurveKind
s = ECCScheme(CurveKind.CK_SECP256K1, getprovider())
You can test the module using unittest:
$ python -m unittest elite.test --verbose
For deeper usage, please view the source code.
Metadata
Release files for Elite 1.1.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 | |
|---|---|---|---|
| Elite-1.1.1.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Elite-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.8 kB
Release files / Elite-1.1.1.tar.gz
| Download URL | Elite-1.1.1.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07a6a399cb4a1b61c45c484c5c4a072231cb3b57153ee04054e398f404228836
|
|
BLAKE2b-256 checksum How to use checksums |
e2512c3ef920a398f4b6291d1e2e321847e43cd2094e98689ba51efd685061ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|
Release files / Elite-1.1.1-py3-none-any.whl
| Download URL | Elite-1.1.1-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1e7d1009fe44b0fb0718658b7bfc87ae7d8483783f6641c0f45df2150716d7c
|
|
BLAKE2b-256 checksum How to use checksums |
2f7436139c2794ee9abb73f2618f2a8e153c37f0a20f78bb04d3fe946be1776b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|