# Path: subspace/pyelliptic/openssl.py
# class CipherName:
# class _OpenSSL:
#     def __init__(self, name, pointer, blocksize):
#     def __str__(self):
#     def get_pointer(self):
#     def get_name(self):
#     def get_blocksize(self):
#     def __init__(self, library):
#     def _set_ciphers(self):
#     def _set_curves(self):
#     def BN_num_bytes(self, x):
#     def get_cipher(self, name):
#     def get_curve(self, name):
#     def get_curve_by_id(self, id):
#     def rand(self, size):
#     def malloc(self, data, size):


from .openssl import OpenSSL
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#  Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
#  See LICENSE for details.



class Cipher:
    """
    Symmetric encryption

        import pyelliptic
        iv = pyelliptic.Cipher.gen_IV('aes-256-cfb')
        ctx = pyelliptic.Cipher("secretkey", iv, 1, ciphername='aes-256-cfb')
        ciphertext = ctx.update('test1')
        ciphertext += ctx.update('test2')
        ciphertext += ctx.final()

        ctx2 = pyelliptic.Cipher("secretkey", iv, 0, ciphername='aes-256-cfb')
        print ctx2.ciphering(ciphertext)
    """
    def __init__(self, key, iv, do, ciphername='aes-256-cbc'):
        """
        do == 1 => Encrypt; do == 0 => Decrypt
        """

# Path: subspace/pyelliptic/openssl.py
# class CipherName:
# class _OpenSSL:
#     def __init__(self, name, pointer, blocksize):
#     def __str__(self):
#     def get_pointer(self):
#     def get_name(self):
#     def get_blocksize(self):
#     def __init__(self, library):
#     def _set_ciphers(self):
#     def _set_curves(self):
#     def BN_num_bytes(self, x):
#     def get_cipher(self, name):
#     def get_curve(self, name):
#     def get_curve_by_id(self, id):
#     def rand(self, size):
#     def malloc(self, data, size):


# Path: subspace/pyelliptic/cipher.py
from .openssl import OpenSSL

#!/usr/bin/env python
# -*- coding: utf-8 -*-

#  Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
#  See LICENSE for details.



class Cipher:
    """
    Symmetric encryption

        import pyelliptic
        iv = pyelliptic.Cipher.gen_IV('aes-256-cfb')
        ctx = pyelliptic.Cipher("secretkey", iv, 1, ciphername='aes-256-cfb')
        ciphertext = ctx.update('test1')
        ciphertext += ctx.update('test2')
        ciphertext += ctx.final()

        ctx2 = pyelliptic.Cipher("secretkey", iv, 0, ciphername='aes-256-cfb')
        print ctx2.ciphering(ciphertext)
    """
    def __init__(self, key, iv, do, ciphername='aes-256-cbc'):
        """
        do == 1 => Encrypt; do == 0 => Decrypt
        """

        self.cipher = OpenSSL.get_cipher(ciphername)