Skip to main content

Python OpenSSL wrapper. For modern cryptography with ECC, AES, HMAC, Blowfish, ...

Project description

PyElliptic is a high level wrapper for the cryptographic library : OpenSSL.
Under the GNU General Public License

Python3 compatible. For GNU/Linux and Windows.
Require OpenSSL

Feature :
Asymmetric cryptography using Elliptic Curve Cryptography (ECC):
- Key agreement : ECDH
- Digital signatures : ECDSA
- Hybrid encryption : ECIES (like RSA)

Symmetric cryptography:
- AES-128 (CFB and CBC)
- AES-256 (CFB and CBC)
- Blowfish (CFB and CBC)

- HMAC (using SHA512)

Example :


import pyelliptic

# Symmetric encryption
iv = pyelliptic.cipher.gen_IV('aes-256-cfb')
ctx = pyelliptic.cipher("secretkey", iv, 1, ciphername='aes-256-cfb')

ciphertext =

ctx2 = pyelliptic.cipher("secretkey", iv, 0, ciphername='aes-256-cfb')
print ctx2.ciphering(ciphertext)

# Asymmetric encryption
alice = pyelliptic.ecc() # default curve: sect283r1
bob = pyelliptic.ecc(curve='sect571r1')

ciphertext = alice.encrypt("Hello Bob", bob.get_pubkey())
print bob.decrypt(ciphertext)

signature = bob.sign("Hello Alice")
# alice's job :
print pyelliptic.ecc(pubkey=bob.get_pubkey()).verify(signature, "Hello Alice")

# ERROR !!!
key = alice.get_ecdh_key(bob.get_pubkey())
except: print("For ECDH key agreement, the keys must be defined on the same curve !")

alice = pyelliptic.ecc(curve='sect571r1')
print alice.get_ecdh_key(bob.get_pubkey()).encode('hex')
print bob.get_ecdh_key(alice.get_pubkey()).encode('hex')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyelliptic, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size pyelliptic-1.1.tar.gz (7.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page