aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/hazmat/primitives/asymmetric
diff options
context:
space:
mode:
authorColleen Murphy <cmurphy@users.noreply.github.com>2016-06-04 09:09:08 -0700
committerPaul Kehrer <paul.l.kehrer@gmail.com>2016-06-04 09:09:08 -0700
commit34d5c39a9c1efa6c2f2c9f473890ebe44816e85a (patch)
tree8009a882571352fbd33ad05ff82c841eb4a0ff2e /src/cryptography/hazmat/primitives/asymmetric
parent4f125c122499e21050e46f20a18bbc4848b0f43b (diff)
downloadcryptography-34d5c39a9c1efa6c2f2c9f473890ebe44816e85a.tar.gz
cryptography-34d5c39a9c1efa6c2f2c9f473890ebe44816e85a.tar.bz2
cryptography-34d5c39a9c1efa6c2f2c9f473890ebe44816e85a.zip
Add convenience methods to sign and verify w/ RSA (#2945)
This patch adds wrapper methods to allow the user to sign and verify a single message block without having to go through the multi-step process of creating a signer or verifier, updating it with the one message, and finalizing the result. This will make signing and verifying data more user-friendly when only using small messages. Partial bug #1529
Diffstat (limited to 'src/cryptography/hazmat/primitives/asymmetric')
-rw-r--r--src/cryptography/hazmat/primitives/asymmetric/rsa.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/rsa.py b/src/cryptography/hazmat/primitives/asymmetric/rsa.py
index 41b0089e..2cb89515 100644
--- a/src/cryptography/hazmat/primitives/asymmetric/rsa.py
+++ b/src/cryptography/hazmat/primitives/asymmetric/rsa.py
@@ -40,6 +40,12 @@ class RSAPrivateKey(object):
The RSAPublicKey associated with this private key.
"""
+ @abc.abstractmethod
+ def sign(self, data, padding, algorithm):
+ """
+ Signs the data.
+ """
+
@six.add_metaclass(abc.ABCMeta)
class RSAPrivateKeyWithSerialization(RSAPrivateKey):
@@ -88,6 +94,12 @@ class RSAPublicKey(object):
Returns the key serialized as bytes.
"""
+ @abc.abstractmethod
+ def verify(self, signature, data, padding, algorithm):
+ """
+ Verifies the signature of the data.
+ """
+
RSAPublicKeyWithSerialization = RSAPublicKey