Merge "Fix unit test error after cryptography update"
This commit is contained in:
commit
461624259e
@ -16,6 +16,7 @@
|
|||||||
"""
|
"""
|
||||||
The following functions were created for testing purposes.
|
The following functions were created for testing purposes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from OpenSSL import crypto
|
from OpenSSL import crypto
|
||||||
|
|
||||||
|
|
||||||
@ -44,14 +45,21 @@ def create_good_csr():
|
|||||||
|
|
||||||
|
|
||||||
def create_csr_that_has_not_been_signed():
|
def create_csr_that_has_not_been_signed():
|
||||||
"""Generate a CSR that has not been signed."""
|
"""Return a CSR that has not been signed."""
|
||||||
key_pair = create_key_pair(crypto.TYPE_RSA, 2048)
|
# NOTE(xek): This method was relying on unsupported behaviour
|
||||||
csr = crypto.X509Req()
|
# in OpenSSL to create an unsigned CSR in the past, so just
|
||||||
subject = csr.get_subject()
|
# return a pre-generated certificate request.
|
||||||
setattr(subject, "CN", "host.example.net")
|
return b"""-----BEGIN CERTIFICATE REQUEST-----
|
||||||
csr.set_pubkey(key_pair)
|
MIIBUTCCAUgCAQAwGzEZMBcGA1UEAwwQaG9zdC5leGFtcGxlLm5ldDCCASIwDQYJ
|
||||||
pem = crypto.dump_certificate_request(crypto.FILETYPE_PEM, csr)
|
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAPPO24Fzfoh4pAqfzGrJGEwINi42MY4S
|
||||||
return pem
|
NMI8+l53vwD0Ld5FN9O044NAuDrGv5KbCoKI6APRYsESZ3adaiHKXfIiEX9QPn8D
|
||||||
|
wJVU388O7gi43tUFl02a65ffczDDYQqHc05rFACvYhYzsjXescqeQjQydI8GcSe0
|
||||||
|
UGsi4IEyU3iI9hKgYwGRRbPezlkpK5t/wW08Qv1muPNkJi1kJklSrNbVYfN+lj7U
|
||||||
|
e3hntigVIo9AP7d++YcMVelrQqFRkhC9+LPo75cKZ5qONQKp5qbDXuHyXh8/H3gv
|
||||||
|
G903n2Dy9QqqV3zNbDyhBLcjv6802ITtSZSv/GuGM2UUj1o+Eo4B2ycCAwEAAaAA
|
||||||
|
MAADAQA=
|
||||||
|
-----END CERTIFICATE REQUEST-----
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def create_csr_signed_with_wrong_key():
|
def create_csr_signed_with_wrong_key():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user