All Projects → bwesterb → Py Seccure

bwesterb / Py Seccure

Licence: lgpl-3.0
SECCURE compatible Elliptic Curve cryptography in Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Py Seccure

2016lykagguvenligivesizmatestleri
Network Security Notes ☔️
Stars: ✭ 75 (-16.67%)
Mutual labels:  cryptography
Cryptr
A simple shell utility for encrypting and decrypting files using OpenSSL.
Stars: ✭ 81 (-10%)
Mutual labels:  cryptography
Argon2pw
Argon2 password hashing package for go with constant time hash comparison
Stars: ✭ 85 (-5.56%)
Mutual labels:  cryptography
Waves Api
Waves API library for Node.js and browser
Stars: ✭ 78 (-13.33%)
Mutual labels:  cryptography
Awa Ssh
Purely functional SSH library in ocaml.
Stars: ✭ 80 (-11.11%)
Mutual labels:  cryptography
Bitcoin Cryptography Library
Nayuki's implementation of cryptographic primitives used in Bitcoin.
Stars: ✭ 81 (-10%)
Mutual labels:  cryptography
Libbls
BLS signatures, threshold encryption, distributed key generation library in modern C++. Actively maintained and used by SKALE for consensus, distributed random number gen, inter-chain communication and protection of transactions. BLS threshold signatures can be verified in Solidity, and used as random beacon (common coin)
Stars: ✭ 74 (-17.78%)
Mutual labels:  cryptography
Tokenscript
TokenScript schema, specs and paper
Stars: ✭ 89 (-1.11%)
Mutual labels:  cryptography
Recrypt Rs
A set of cryptographic primitives for building a multi-hop Proxy Re-encryption scheme, known as Transform Encryption.
Stars: ✭ 81 (-10%)
Mutual labels:  cryptography
Fresco
A FRamework for Efficient Secure COmputation
Stars: ✭ 83 (-7.78%)
Mutual labels:  cryptography
Yubikeylockd
Simple daemon for locking and unlocking macOS with Yubikey
Stars: ✭ 78 (-13.33%)
Mutual labels:  cryptography
Lightning Rfc
Lightning Network Specifications
Stars: ✭ 1,224 (+1260%)
Mutual labels:  cryptography
Beamsplitter
💎 Beamsplitter - A new (possibly universal) hash that passes SMHasher. Built mainly with a random 10x64 S-box. Also in NodeJS
Stars: ✭ 83 (-7.78%)
Mutual labels:  cryptography
Acvp
Industry Working Group on Automated Cryptographic Algorithm Validation
Stars: ✭ 76 (-15.56%)
Mutual labels:  cryptography
Pentesting toolkit
🏴‍☠️ Tools for pentesting, CTFs & wargames. 🏴‍☠️
Stars: ✭ 1,268 (+1308.89%)
Mutual labels:  cryptography
Simon speck ciphers
Implementations of the Simon and Speck Block Ciphers
Stars: ✭ 74 (-17.78%)
Mutual labels:  cryptography
Themis
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Stars: ✭ 1,232 (+1268.89%)
Mutual labels:  cryptography
Paramikojs
port of the paramiko library from python->javascript
Stars: ✭ 89 (-1.11%)
Mutual labels:  cryptography
Zcash Mini
A minimal portable Zcash z-address generator for offline / paper wallets
Stars: ✭ 87 (-3.33%)
Mutual labels:  cryptography
Js Ethereum Cryptography
Every cryptographic primitive needed to work on Ethereum, for the browser and Node.js
Stars: ✭ 83 (-7.78%)
Mutual labels:  cryptography

py-seccure

Simple Elliptic Curve Cryptography for Python compatible with the excellent SECCURE_ command line utility (version 0.5). It's licensed under LGPLv3. See LICENSE.

Do not use py-seccure when its operation can be timed by an attacker. See timing attack_.

Usage

Public key from private


To get the public key from the private, you can use the original
commandline utility:

::

    $ seccure-key
    Assuming curve p160.
    Enter private key: my private key
    The public key is: 8W;>i^H0qi|J&$coR5MFpR*Vn

In Python:

.. code:: python

    >>> import seccure
    >>> str(seccure.passphrase_to_pubkey(b'my private key'))
    '8W;>i^H0qi|J&$coR5MFpR*Vn'

Encrypting a string
~~~~~~~~~~~~~~~~~~~

To encrypt for a public key, one would use the original commandline
utility as follows.

::

    $ seccure-encrypt -o private.msg '8W;>i^H0qi|J&$coR5MFpR*Vn'  
    Assuming MAC length of 80 bits.
    Go ahead and type your message ...
    This is a very very secret message!
    ^D

In Python:

.. code:: python

    >>> ciphertext = seccure.encrypt(b'This is a very secret message\n', b'8W;>i^H0qi|J&$coR5MFpR*Vn')
    >>> ciphertext
    '\x00\x146\x17\xe9\xc1\x1a\x7fkX\xec\xa0n,h\xb4\xd0\x98\xeaO[\xf8\xfa\x85\xaa\xb37!\xf0j\x0e\xd4\xd0\x8b\xfe}\x8a\xd2+\xf2\xceu\x07\x90K2E\x12\x1d\xf1\xd8\x8f\xc6\x91\t<w\x99\x1b9\x98'

There is a shorthand to encrypt a file:

.. code:: python

    >>> seccure.encrypt_file('/path/to/file',  '/path/to/file.enc', '8W;>i^H0qi|J&$coR5MFpR*Vn')

Decrypting
~~~~~~~~~~

To decrypt the message with the original utility:

::

    $ seccure-decrypt -i private.msg
    Assuming MAC length of 80 bits.
    Assuming curve p160.
    Enter private key: my private key
    This is a very very secret message!
    Integrity check successful, message unforged!

In Python:

.. code:: python

    >>> seccure.decrypt(ciphertext, b'my private key')
    'This is a very secret message\n'

And to decrypt a file:

.. code:: python

    >>> seccure.decrypt_file('/path/to/file.enc',  '/path/to/file', b'my private key')

Creating a signature
~~~~~~~~~~~~~~~~~~~~

To create a signature:

::

    $ seccure-sign
    Assuming curve p160.
    Enter private key: my private key
    Go ahead and type your message ...
    This message will be signed
    ^D
    Signature: $HPI?t(I*1vAYsl$|%21WXND=6Br*[>k(OR9B!GOwHqL0s+3Uq

In Python:

.. code:: python

    >>> seccure.sign(b'This message will be signed\n', b'my private key')
    '$HPI?t(I*1vAYsl$|%21WXND=6Br*[>k(OR9B!GOwHqL0s+3Uq'

Verifying a signature
~~~~~~~~~~~~~~~~~~~~~

To verify a signature:

::

    $ seccure-verify '8W;>i^H0qi|J&$coR5MFpR*Vn' '$HPI?t(I*1vAYsl$|%21WXND=6Br*[>k(OR9B!GOwHqL0s+3Uq'  
    Go ahead and type your message ...
    This message will be signed
    ^D
    Signature successfully verified!

In Python:

.. code:: python

    >>> seccure.verify(b'This message will be signed\n', b'$HPI?t(I*1vAYsl$|%21WXND=6Br*[>k(OR9B!GOwHqL0s+3Uq', b'8W;>i^H0qi|J&$coR5MFpR*Vn')
    True

Installation
------------

On Debian Wheezy
~~~~~~~~~~~~~~~~

::

    $ apt-get install libgmp3-dev build-essential python-dev python-pip libmpfr-dev libmpc-dev
    $ pip install seccure

On Ubuntu
~~~~~~~~~

::

    $ apt-get install libgmp-dev build-essential python-dev python-pip libmpfr-dev libmpc-dev
    $ pip install seccure

On Mac with MacPorts
~~~~~~~~~~~~~~~~~~~~

::

    $ port install py27-gmpy2
    $ pip install seccure

Please contribute!
------------------

To help out, you could:

1. Test and report any bugs or other difficulties.
2. Implement missing features, such as ``seccure-dh``,
   ``seccure-veridec`` and ``seccure-signcrypt``.
3. Package py-seccure (or the original SECCURE itself) for your
   platform.
4. Write more unit tests.

.. image:: https://travis-ci.org/bwesterb/py-seccure.png
   :target: https://travis-ci.org/py-seccure/py-seccure

.. _SECCURE: http://point-at-infinity.org/seccure/
.. _timing attack: http://en.wikipedia.org/wiki/Timing_attack
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].