1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

tests/krb5: Have the caller of create_certificate() fetch the CA certificate and private key

These are useful to keep around for other purposes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9612

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-07-05 12:55:41 +12:00 committed by Andrew Bartlett
parent 01196cc741
commit b73a01eefd

View File

@ -699,14 +699,16 @@ class PkInitTests(KDCBaseTest):
return ca_cert, ca_private_key
def create_certificate(self, creds, certificate_signature=None):
def create_certificate(self,
creds,
ca_cert,
ca_private_key,
certificate_signature=None):
if certificate_signature is None:
certificate_signature = hashes.SHA1
user_name = creds.get_username()
ca_cert, ca_private_key = self.get_ca_cert_and_private_key()
builder = x509.CertificateBuilder()
# Add the subject name.
@ -873,8 +875,13 @@ class PkInitTests(KDCBaseTest):
signature_algorithm_id = self.AlgorithmIdentifier_create(
signature_algorithm)
ca_cert, ca_private_key = self.get_ca_cert_and_private_key()
# Create a certificate for the client signed by the CA.
certificate = self.create_certificate(creds, certificate_signature)
certificate = self.create_certificate(creds,
ca_cert,
ca_private_key,
certificate_signature)
private_key = creds.get_private_key()