From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: ell@lists.linux.dev
Subject: [PATCH 3/4] build: Generate an expired test certificate
Date: Mon, 31 Oct 2022 11:53:41 +0100 [thread overview]
Message-ID: <20221031105342.2660357-3-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20221031105342.2660357-1-andrew.zaborowski@intel.com>
---
.gitignore | 2 ++
Makefile.am | 29 +++++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 76f10ae..1540012 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,6 +67,8 @@ unit/cert-*.csr
unit/cert-*.srl
unit/cert-*.crt
unit/cert-*.p12
+unit/cert-ca.cnf
+unit/cert-ca-index*
unit/ec-cert-*.pem
unit/ec-cert-*.csr
unit/key-*.dat
diff --git a/Makefile.am b/Makefile.am
index 596771a..7daebde 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -242,7 +242,8 @@ cert_files = unit/cert-chain.pem \
unit/cert-entity-pkcs12-rc4-sha384.p12 \
unit/cert-entity-pkcs12-pkcs5-sha512.p12 \
unit/cert-entity-combined.pem \
- unit/cert-no-keyid.pem
+ unit/cert-no-keyid.pem \
+ unit/cert-expired.pem
cert_checks = unit/cert-intca \
unit/cert-entity-int \
@@ -617,6 +618,29 @@ unit/cert-no-keyid.pem: unit/cert-no-keyid.csr unit/cert-ca2.pem unit/gencerts.c
unit/cert-no-keyid: unit/cert-no-keyid.pem unit/cert-ca2.pem
$(AM_V_GEN)openssl verify -CAfile $(builddir)/unit/cert-ca2.pem $<
+unit/cert-expired.csr: unit/cert-client-key-pkcs1.pem unit/gencerts.cnf
+ $(AM_V_GEN)openssl req -new -extensions cert_ext \
+ -config $(srcdir)/unit/gencerts.cnf \
+ -subj '/O=Bar Example Organization/CN=Bar Example Organization/emailAddress=bar@mail.example' \
+ -key $< -out $@
+
+unit/cert-ca.cnf:
+ $(AM_V_GEN)echo -e '[example]\ndatabase = unit/cert-ca-index.txt\npolicy = dummy\nserial = dummy\n[dummy]' > $@
+
+unit/cert-expired.pem: unit/cert-expired.csr unit/cert-ca.pem unit/gencerts.cnf unit/cert-ca.cnf
+ $(AM_V_at)> unit/cert-ca-index.txt
+ $(AM_V_at)$(MKDIR_P) unit/cert-ca-tmp
+ $(AM_V_GEN)openssl ca -batch \
+ -config $(builddir)/unit/cert-ca.cnf -name example \
+ -cert $(builddir)/unit/cert-ca.pem \
+ -keyfile $(builddir)/unit/cert-ca-key.pem \
+ -outdir $(builddir)/unit/cert-ca-tmp \
+ -rand_serial -extensions cert_ext \
+ -extfile $(srcdir)/unit/gencerts.cnf -md sha256 \
+ -startdate 000101120000Z -enddate 010101120000Z \
+ -preserveDN -notext -in $< -out $@ 2> /dev/null
+ $(AM_V_at)rm -r unit/cert-ca-tmp unit/cert-ca-index.txt
+
unit/cert-entity-pkcs12-nomac.p12: unit/cert-entity-int-key.pem unit/cert-entity-int.pem
$(AM_V_GEN)openssl pkcs12 -inkey $< -in $(builddir)/unit/cert-entity-int.pem -out $@ -export -passout pass:abc -nomac # defaut ciphers
@@ -660,7 +684,8 @@ endif
clean-local:
-rm -f unit/ec-cert*.pem unit/ec-cert-*.csr \
- unit/cert-*.pem unit/cert-*.csr unit/cert-*.srl unit/key-*.dat
+ unit/cert-*.pem unit/cert-*.csr unit/cert-*.srl unit/key-*.dat \
+ unit/cert-ca-index* unit/cert-ca.cnf
maintainer-clean-local:
-rm -rf build-aux
--
2.34.1
next prev parent reply other threads:[~2022-10-31 10:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 10:53 [PATCH 1/4] cert: Fix logic in cert_parse_asn1_time check Andrew Zaborowski
2022-10-31 10:53 ` [PATCH 2/4] cert: Check validity dates in l_certchain_verify Andrew Zaborowski
2022-11-01 14:04 ` Denis Kenzior
2022-10-31 10:53 ` Andrew Zaborowski [this message]
2022-10-31 10:53 ` [PATCH 4/4] unit: Minimal l_certchain_verify validity dates test Andrew Zaborowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221031105342.2660357-3-andrew.zaborowski@intel.com \
--to=andrew.zaborowski@intel.com \
--cc=ell@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).