Skip to main content

A lightweight module for elliptic-curve security schemes.

Project description

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.

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

Elite-1.1.1.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

Elite-1.1.1-py3-none-any.whl (9.1 kB view hashes)

Uploaded Python 3

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