# Path: axolotl/ecc/eckeypair.py
# class ECKeyPair():
#     def __init__(self, publicKey, privateKey):
#         """
#         :type publicKey: ECPublicKey
#         :type privateKey: ECPrivateKey
#         """
#         self.publicKey = publicKey
#         self.privateKey = privateKey
# 
#     def getPrivateKey(self):
#         return self.privateKey
# 
#     def getPublicKey(self):
#         return self.publicKey
# 
# Path: axolotl/invalidkeyexception.py
# class InvalidKeyException(Exception):
#     pass


import os
import axolotl_curve25519 as _curve
from .eckeypair import ECKeyPair
from ..invalidkeyexception import InvalidKeyException
        from .djbec import DjbECPublicKey, DjbECPrivateKey
            from .djbec import DjbECPublicKey
        from .djbec import DjbECPrivateKey
        if publicKey.getType() == Curve.DJB_TYPE:
            return _curve.calculateAgreement(privateKey.getPrivateKey(), publicKey.getPublicKey())
        else:
            raise InvalidKeyException("Unknown type: %s" % publicKey.getType())

    @staticmethod
    def verifySignature(ecPublicSigningKey, message, signature):
        """
        :type ecPublicSigningKey: ECPublicKey
        :type message: bytearray
        :type signature: bytearray
        """

        if ecPublicSigningKey.getType() == Curve.DJB_TYPE:
            result = _curve.verifySignature(ecPublicSigningKey.getPublicKey(), message, signature)
            return result == 0
        else:
            raise InvalidKeyException("Unknown type: %s" % ecPublicSigningKey.getType())

    @staticmethod
    def calculateSignature(privateSigningKey, message):
        """
        :type privateSigningKey: ECPrivateKey
        :type  message: bytearray
        """
        if privateSigningKey.getType() == Curve.DJB_TYPE:
            rand = os.urandom(64)
            res = _curve.calculateSignature(rand, privateSigningKey.getPrivateKey(), message)
            return res
        else:

# Path: axolotl/ecc/eckeypair.py
# class ECKeyPair():
#     def __init__(self, publicKey, privateKey):
#         """
#         :type publicKey: ECPublicKey
#         :type privateKey: ECPrivateKey
#         """
#         self.publicKey = publicKey
#         self.privateKey = privateKey
# 
#     def getPrivateKey(self):
#         return self.privateKey
# 
#     def getPublicKey(self):
#         return self.publicKey
# 
# Path: axolotl/invalidkeyexception.py
# class InvalidKeyException(Exception):
#     pass


# Path: axolotl/ecc/curve.py
import os
import axolotl_curve25519 as _curve
from .eckeypair import ECKeyPair
from ..invalidkeyexception import InvalidKeyException
        from .djbec import DjbECPublicKey, DjbECPrivateKey
            from .djbec import DjbECPublicKey
        from .djbec import DjbECPrivateKey

        if publicKey.getType() == Curve.DJB_TYPE:
            return _curve.calculateAgreement(privateKey.getPrivateKey(), publicKey.getPublicKey())
        else:
            raise InvalidKeyException("Unknown type: %s" % publicKey.getType())

    @staticmethod
    def verifySignature(ecPublicSigningKey, message, signature):
        """
        :type ecPublicSigningKey: ECPublicKey
        :type message: bytearray
        :type signature: bytearray
        """

        if ecPublicSigningKey.getType() == Curve.DJB_TYPE:
            result = _curve.verifySignature(ecPublicSigningKey.getPublicKey(), message, signature)
            return result == 0
        else:
            raise InvalidKeyException("Unknown type: %s" % ecPublicSigningKey.getType())

    @staticmethod
    def calculateSignature(privateSigningKey, message):
        """
        :type privateSigningKey: ECPrivateKey
        :type  message: bytearray
        """
        if privateSigningKey.getType() == Curve.DJB_TYPE:
            rand = os.urandom(64)
            res = _curve.calculateSignature(rand, privateSigningKey.getPrivateKey(), message)
            return res
        else:

            raise InvalidKeyException("Unknown type: %s" % privateSigningKey.getType())