aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Attia <skeuomorf@gmail.com>2014-03-03 16:27:07 +0200
committerMohammed Attia <skeuomorf@gmail.com>2014-03-03 16:27:07 +0200
commitd0b0c73d1d87423f4a63ba05ab4cf1f290a5af02 (patch)
treeecc57497cc5a7e6769254808d849369cfdb07cc2
parent930eed8bcbea6f6250998f0ee042babd62667a9f (diff)
downloadcryptography-d0b0c73d1d87423f4a63ba05ab4cf1f290a5af02.tar.gz
cryptography-d0b0c73d1d87423f4a63ba05ab4cf1f290a5af02.tar.bz2
cryptography-d0b0c73d1d87423f4a63ba05ab4cf1f290a5af02.zip
Add DSA interfaces
-rw-r--r--cryptography/hazmat/primitives/interfaces.py188
1 files changed, 188 insertions, 0 deletions
diff --git a/cryptography/hazmat/primitives/interfaces.py b/cryptography/hazmat/primitives/interfaces.py
index 11696160..663f9655 100644
--- a/cryptography/hazmat/primitives/interfaces.py
+++ b/cryptography/hazmat/primitives/interfaces.py
@@ -287,6 +287,194 @@ class RSAPublicKey(six.with_metaclass(abc.ABCMeta)):
"""
+class DSAParams(six.with_metaclass(abc.ABCMeta)):
+ @abc.abstractproperty
+ def modulus(self):
+ """
+ The prime modulus that's used in generating the DSA keypair.
+ """
+
+ @abc.abstractproperty
+ def divisor(self):
+ """
+ The prime divisor of (p-1) that's used in generating the DSA keypair.
+ """
+
+ @abc.abstractproperty
+ def generator(self):
+ """
+ The generator that is used in generating the DSA keypair.
+ """
+
+ @abc.abstractmethod
+ def generate(self):
+ """
+ Generate DSAPrivateKey from the object's parameters
+ """
+
+ @abc.abstractproperty
+ def p(self):
+ """
+ The prime modulus that's used in generating the DSA keypair.
+ Alias for modulus.
+ """
+
+ @abc.abstractproperty
+ def q(self):
+ """
+ The prime divisor of (p-1) that's used in generating the DSA keypair.
+ Alias for divisor.
+ """
+
+ @abc.abstractproperty
+ def g(self):
+ """
+ The generator that is used in generating the DSA keypair.
+ Alias for generator.
+ """
+
+
+class DSAPrivateKey(six.with_metaclass(abc.ABCMeta)):
+ @abc.abstractproperty
+ def modulus(self):
+ """
+ The prime modulus that's used in generating the DSA keypair.
+ """
+
+ @abc.abstractproperty
+ def divisor(self):
+ """
+ The prime divisor of (p-1) that's used in generating the DSA keypair.
+ """
+
+ @abc.abstractproperty
+ def generator(self):
+ """
+ The generator that is used in generating the DSA keypair.
+ """
+
+ @abc.abstractproperty
+ def modulus_length(self):
+ """
+ The bit length of the prime modulus.
+ """
+
+ @abc.abstractproperty
+ def divisor_length(self):
+ """
+ The bit length of the divisor.
+ """
+
+ @abc.abstractproperty
+ def priv_key(self):
+ """
+ The private key in the DSA structure.
+ """
+
+ @abc.abstractproperty
+ def public_key(self):
+ """
+ The DSAPublicKey associated with this private key.
+ """
+
+ @abc.abstractproperty
+ def p(self):
+ """
+ The prime modulus that's used in generating the DSA keypair.
+ Alias for modulus.
+ """
+
+ @abc.abstractproperty
+ def q(self):
+ """
+ The prime divisor of (p-1) that's used in generating the DSA keypair.
+ Alias for divisor.
+ """
+
+ @abc.abstractproperty
+ def g(self):
+ """
+ The generator that is used in generating the DSA keypair.
+ Alias for generator.
+ """
+
+ @abc.abstractproperty
+ def L(self):
+ """
+ The bit length of the prime modulus. Alias for modulus_length.
+ """
+
+ @abc.abstractproperty
+ def N(self):
+ """
+ The bit length of the divisor. Alias for divisor_length.
+ """
+
+ @abc.abstractproperty
+ def y(self):
+ """
+ The DSAPublicKey associated with this private key.
+ Alias for public_key.
+ """
+
+ @abc.abstractproperty
+ def params(self):
+ """
+ The params associated with a DSA keypair
+ """
+
+
+class DSAPublicKey(six.with_metaclass(abc.ABCMeta)):
+ @abc.abstractproperty
+ def modulus(self):
+ """
+ The prime modulus that's used in generating the DSA keypair.
+ """
+
+ @abc.abstractproperty
+ def divisor(self):
+ """
+ The prime divisor of (p-1) that's used in generating the DSA keypair.
+ """
+
+ @abc.abstractproperty
+ def generator(self):
+ """
+ The generator that is used in generating the DSA keypair.
+ """
+
+ @abc.abstractproperty
+ def pub_key(self):
+ """
+ The pub_key that's in the DSA structure, also known as y.
+ """
+ @abc.abstractproperty
+ def p(self):
+ """
+ The prime modulus that's used in generating the DSA keypair.
+ Alias for modulus.
+ """
+
+ @abc.abstractproperty
+ def q(self):
+ """
+ The prime divisor of (p-1) that's used in generating the DSA keypair.
+ Alias for divisor.
+ """
+
+ @abc.abstractproperty
+ def g(self):
+ """
+ The generator that is used in generating the DSA keypair.
+ Alias for generator.
+ """
+
+ @abc.abstractproperty
+ def params(self):
+ """
+ The params associated with a DSA keypair
+ """
+
class AsymmetricSignatureContext(six.with_metaclass(abc.ABCMeta)):
@abc.abstractmethod
def update(self, data):