Skip to content

Commit d787541

Browse files
olszomalmtrojnar
authored andcommitted
tests: add digitalSignature keyUsage to leaf certificate
1 parent 6390ae2 commit d787541

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/make_certificates.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,17 @@ def make_cert(self, public_key, not_before, days) -> Certificate:
338338
authority_key = AuthorityKeyIdentifier.from_issuer_subject_key_identifier(
339339
self.issuer_cert.extensions.get_extension_for_class(SubjectKeyIdentifier).value
340340
)
341+
key_usage = KeyUsage(
342+
digital_signature=True,
343+
content_commitment=False,
344+
key_encipherment=False,
345+
data_encipherment=False,
346+
key_agreement=False,
347+
key_cert_sign=False,
348+
crl_sign=False,
349+
encipher_only=False,
350+
decipher_only=False
351+
)
341352
extended_key_usage = ExtendedKeyUsage(
342353
[ExtendedKeyUsageOID.CODE_SIGNING]
343354
)
@@ -352,6 +363,7 @@ def make_cert(self, public_key, not_before, days) -> Certificate:
352363
.add_extension(BasicConstraints(ca=False, path_length=None), critical=False)
353364
.add_extension(SubjectKeyIdentifier.from_public_key(public_key), critical=False)
354365
.add_extension(authority_key, critical=False)
366+
.add_extension(key_usage, critical=False)
355367
.add_extension(extended_key_usage, critical=False)
356368
.add_extension(self.create_x509_crldp(), critical=False)
357369
.sign(self.issuer_key, SHA256())

0 commit comments

Comments
 (0)