aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGregory Haynes <greg@greghaynes.net>2015-01-03 09:28:23 -0800
committerGregory Haynes <greg@greghaynes.net>2015-01-03 09:28:23 -0800
commitcc90f60109a6d123de679330363494356948aa54 (patch)
tree7f985bb4b2361925fa317f52a13b5d97fc4043ac /src
parent480b4f58631406b8ec9aac5732a49a4e5a1428e5 (diff)
downloadcryptography-cc90f60109a6d123de679330363494356948aa54.tar.gz
cryptography-cc90f60109a6d123de679330363494356948aa54.tar.bz2
cryptography-cc90f60109a6d123de679330363494356948aa54.zip
Only split out ec and dsa
RSA is being mvoed out of the interfaces namespace in PR #1592.
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/primitives/interfaces/__init__.py76
-rw-r--r--src/cryptography/hazmat/primitives/interfaces/asymmetric/rsa.py75
2 files changed, 67 insertions, 84 deletions
diff --git a/src/cryptography/hazmat/primitives/interfaces/__init__.py b/src/cryptography/hazmat/primitives/interfaces/__init__.py
index 8b6b1f8c..fb5ceeae 100644
--- a/src/cryptography/hazmat/primitives/interfaces/__init__.py
+++ b/src/cryptography/hazmat/primitives/interfaces/__init__.py
@@ -17,10 +17,6 @@ from cryptography.hazmat.primitives.interfaces.asymmetric.ec import (
EllipticCurvePublicKey, EllipticCurvePublicKeyWithNumbers,
EllipticCurveSignatureAlgorithm
)
-from cryptography.hazmat.primitives.interfaces.asymmetric.rsa import (
- RSAPrivateKey, RSAPrivateKeyWithNumbers, RSAPublicKey,
- RSAPublicKeyWithNumbers
-)
from cryptography.hazmat.primitives.interfaces.ciphers import (
BlockCipherAlgorithm, CipherAlgorithm, Mode,
ModeWithAuthenticationTag, ModeWithInitializationVector, ModeWithNonce
@@ -44,11 +40,7 @@ __all__ = [
"Mode",
"ModeWithAuthenticationTag",
"ModeWithInitializationVector",
- "ModeWithNonce",
- "RSAPrivateKey",
- "RSAPrivateKeyWithNumbers",
- "RSAPublicKey",
- "RSAPublicKeyWithNumbers"
+ "ModeWithNonce"
]
@@ -151,6 +143,72 @@ class HashContext(object):
@six.add_metaclass(abc.ABCMeta)
+class RSAPrivateKey(object):
+ @abc.abstractmethod
+ def signer(self, padding, algorithm):
+ """
+ Returns an AsymmetricSignatureContext used for signing data.
+ """
+
+ @abc.abstractmethod
+ def decrypt(self, ciphertext, padding):
+ """
+ Decrypts the provided ciphertext.
+ """
+
+ @abc.abstractproperty
+ def key_size(self):
+ """
+ The bit length of the public modulus.
+ """
+
+ @abc.abstractmethod
+ def public_key(self):
+ """
+ The RSAPublicKey associated with this private key.
+ """
+
+
+@six.add_metaclass(abc.ABCMeta)
+class RSAPrivateKeyWithNumbers(RSAPrivateKey):
+ @abc.abstractmethod
+ def private_numbers(self):
+ """
+ Returns an RSAPrivateNumbers.
+ """
+
+
+@six.add_metaclass(abc.ABCMeta)
+class RSAPublicKey(object):
+ @abc.abstractmethod
+ def verifier(self, signature, padding, algorithm):
+ """
+ Returns an AsymmetricVerificationContext used for verifying signatures.
+ """
+
+ @abc.abstractmethod
+ def encrypt(self, plaintext, padding):
+ """
+ Encrypts the given plaintext.
+ """
+
+ @abc.abstractproperty
+ def key_size(self):
+ """
+ The bit length of the public modulus.
+ """
+
+
+@six.add_metaclass(abc.ABCMeta)
+class RSAPublicKeyWithNumbers(RSAPublicKey):
+ @abc.abstractmethod
+ def public_numbers(self):
+ """
+ Returns an RSAPublicNumbers
+ """
+
+
+@six.add_metaclass(abc.ABCMeta)
class AsymmetricSignatureContext(object):
@abc.abstractmethod
def update(self, data):
diff --git a/src/cryptography/hazmat/primitives/interfaces/asymmetric/rsa.py b/src/cryptography/hazmat/primitives/interfaces/asymmetric/rsa.py
deleted file mode 100644
index 35c3e9e6..00000000
--- a/src/cryptography/hazmat/primitives/interfaces/asymmetric/rsa.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# This file is dual licensed under the terms of the Apache License, Version
-# 2.0, and the BSD License. See the LICENSE file in the root of this repository
-# for complete details.
-
-from __future__ import absolute_import, division, print_function
-
-import abc
-
-import six
-
-
-@six.add_metaclass(abc.ABCMeta)
-class RSAPrivateKey(object):
- @abc.abstractmethod
- def signer(self, padding, algorithm):
- """
- Returns an AsymmetricSignatureContext used for signing data.
- """
-
- @abc.abstractmethod
- def decrypt(self, ciphertext, padding):
- """
- Decrypts the provided ciphertext.
- """
-
- @abc.abstractproperty
- def key_size(self):
- """
- The bit length of the public modulus.
- """
-
- @abc.abstractmethod
- def public_key(self):
- """
- The RSAPublicKey associated with this private key.
- """
-
-
-@six.add_metaclass(abc.ABCMeta)
-class RSAPrivateKeyWithNumbers(RSAPrivateKey):
- @abc.abstractmethod
- def private_numbers(self):
- """
- Returns an RSAPrivateNumbers.
- """
-
-
-@six.add_metaclass(abc.ABCMeta)
-class RSAPublicKey(object):
- @abc.abstractmethod
- def verifier(self, signature, padding, algorithm):
- """
- Returns an AsymmetricVerificationContext used for verifying signatures.
- """
-
- @abc.abstractmethod
- def encrypt(self, plaintext, padding):
- """
- Encrypts the given plaintext.
- """
-
- @abc.abstractproperty
- def key_size(self):
- """
- The bit length of the public modulus.
- """
-
-
-@six.add_metaclass(abc.ABCMeta)
-class RSAPublicKeyWithNumbers(RSAPublicKey):
- @abc.abstractmethod
- def public_numbers(self):
- """
- Returns an RSAPublicNumbers
- """