aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-06-26 19:57:18 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2015-06-26 19:57:18 -0400
commitb3b0fbe2fb4f3c6939c05ff90e0201fb78c51074 (patch)
treee8b8a504fe64179906ce965467a46d520eb4438d
parent354fc56e6a9781f3f2213537c3c65d7e720dfcb4 (diff)
downloadcryptography-b3b0fbe2fb4f3c6939c05ff90e0201fb78c51074.tar.gz
cryptography-b3b0fbe2fb4f3c6939c05ff90e0201fb78c51074.tar.bz2
cryptography-b3b0fbe2fb4f3c6939c05ff90e0201fb78c51074.zip
Make the parameter ordering in sign() consistent with other code
-rw-r--r--docs/x509.rst2
-rw-r--r--src/cryptography/x509.py2
-rw-r--r--tests/test_x509.py22
3 files changed, 8 insertions, 18 deletions
diff --git a/docs/x509.rst b/docs/x509.rst
index c4c441e7..79f48299 100644
--- a/docs/x509.rst
+++ b/docs/x509.rst
@@ -515,7 +515,7 @@ X.509 CSR (Certificate Signing Request) Builder Object
:returns: A new
:class:`~cryptography.x509.CertificateSigningRequestBuilder`.
- .. method:: sign(backend, private_key, algorithm)
+ .. method:: sign(private_key, algorithm, backend)
:param backend: Backend that will be used to sign the request.
Must support the
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index 21e18ddd..51e25f7a 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -1478,7 +1478,7 @@ class CertificateSigningRequestBuilder(object):
self._subject_name, self._extensions + [extension]
)
- def sign(self, backend, private_key, algorithm):
+ def sign(self, private_key, algorithm, backend):
"""
Signs the request using the requestor's private key.
"""
diff --git a/tests/test_x509.py b/tests/test_x509.py
index ee83ed2d..971f149c 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -689,7 +689,7 @@ class TestCertificateSigningRequestBuilder(object):
builder = x509.CertificateSigningRequestBuilder()
with pytest.raises(TypeError):
- builder.sign(backend, private_key, 'NotAHash')
+ builder.sign(private_key, 'NotAHash', backend)
@pytest.mark.requires_backend_interface(interface=RSABackend)
def test_build_ca_request_with_rsa(self, backend):
@@ -701,9 +701,7 @@ class TestCertificateSigningRequestBuilder(object):
])
).add_extension(
x509.BasicConstraints(ca=True, path_length=2), critical=True
- ).sign(
- backend, private_key, hashes.SHA1()
- )
+ ).sign(private_key, hashes.SHA1(), backend)
assert isinstance(request.signature_hash_algorithm, hashes.SHA1)
public_key = request.public_key()
@@ -730,9 +728,7 @@ class TestCertificateSigningRequestBuilder(object):
])
).add_extension(
x509.BasicConstraints(ca=True, path_length=2), critical=True
- ).sign(
- backend, private_key, hashes.SHA1()
- )
+ ).sign(private_key, hashes.SHA1(), backend)
loaded_request = x509.load_pem_x509_csr(
request.public_bytes(encoding=serialization.Encoding.PEM), backend
@@ -753,9 +749,7 @@ class TestCertificateSigningRequestBuilder(object):
])
).add_extension(
x509.BasicConstraints(ca=False, path_length=None), critical=True,
- ).sign(
- backend, private_key, hashes.SHA1()
- )
+ ).sign(private_key, hashes.SHA1(), backend)
assert isinstance(request.signature_hash_algorithm, hashes.SHA1)
public_key = request.public_key()
@@ -785,9 +779,7 @@ class TestCertificateSigningRequestBuilder(object):
])
).add_extension(
x509.BasicConstraints(ca=True, path_length=2), critical=True
- ).sign(
- backend, private_key, hashes.SHA1()
- )
+ ).sign(private_key, hashes.SHA1(), backend)
assert isinstance(request.signature_hash_algorithm, hashes.SHA1)
public_key = request.public_key()
@@ -816,9 +808,7 @@ class TestCertificateSigningRequestBuilder(object):
])
).add_extension(
x509.BasicConstraints(ca=True, path_length=2), critical=True
- ).sign(
- backend, private_key, hashes.SHA1()
- )
+ ).sign(private_key, hashes.SHA1(), backend)
assert isinstance(request.signature_hash_algorithm, hashes.SHA1)
public_key = request.public_key()