2013-07-17 23:30:04 +08:00
|
|
|
#!/bin/sh
|
2021-01-28 20:54:57 +08:00
|
|
|
# Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.
|
2016-06-01 23:26:40 +08:00
|
|
|
#
|
2018-12-06 20:05:25 +08:00
|
|
|
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-06-01 23:26:40 +08:00
|
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
|
|
# in the file LICENSE in the source distribution or at
|
|
|
|
# https://www.openssl.org/source/license.html
|
|
|
|
|
2022-08-27 02:40:48 +08:00
|
|
|
# Utility to recreate S/MIME certificates in this directory.
|
|
|
|
# Invoke when changes are need from within this directory.
|
2013-07-17 23:30:04 +08:00
|
|
|
|
|
|
|
OPENSSL=../../apps/openssl
|
2022-08-27 02:40:48 +08:00
|
|
|
CONF=ca.cnf
|
|
|
|
export OPENSSL_CONF=./$CONF
|
|
|
|
|
|
|
|
gen() {
|
|
|
|
$OPENSSL x509 -CA smroot.pem -new -days 36524 -force_pubkey $1 -subj "$2" \
|
|
|
|
-extfile $CONF -extensions $3
|
|
|
|
}
|
2013-07-17 23:30:04 +08:00
|
|
|
|
|
|
|
# Root CA: create certificate directly
|
2020-05-11 21:41:08 +08:00
|
|
|
CN="Test S/MIME RSA Root" $OPENSSL req -config ca.cnf -x509 -noenc \
|
2022-08-26 00:09:09 +08:00
|
|
|
-keyout smroot.pem -out smroot.pem -key ../certs/ca-key.pem -days 36524
|
|
|
|
|
|
|
|
# EE RSA certificates with respective extensions
|
|
|
|
cp ../certs/ee-key.pem smrsa1.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smrsa1.pem "/CN=Test SMIME EE RSA #1" usr_rsa_cert >>smrsa1.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
cp ../certs/ee-key-3072.pem smrsa2.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smrsa2.pem "/CN=Test SMIME EE RSA #2" usr_rsa_cert >>smrsa2.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
cp ../certs/ee-key-4096.pem smrsa3.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smrsa3.pem "/CN=Test SMIME EE RSA #3" usr_rsa_cert >>smrsa3.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
|
|
|
|
# Create DSA certificates with respective extensions
|
|
|
|
|
|
|
|
cp ../certs/server-dsa-key.pem smdsa1.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smdsa1.pem "/CN=Test SMIME EE DSA #1" signer_cert >>smdsa1.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
cp ../certs/server-dsa-key.pem smdsa2.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smdsa2.pem "/CN=Test SMIME EE DSA #1" signer_cert >>smdsa2.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
cp ../certs/server-dsa-key.pem smdsa3.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smdsa3.pem "/CN=Test SMIME EE DSA #1" signer_cert >>smdsa3.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
|
|
|
|
# Create EC certificates with respective extensions
|
|
|
|
|
|
|
|
cp ../certs/ee-ecdsa-key.pem smec1.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smec1.pem "/CN=Test SMIME EE EC #1" signer_cert >>smec1.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
cp ../certs/server-ecdsa-key.pem smec2.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smec2.pem "/CN=Test SMIME EE EC #2" signer_cert >>smec2.pem
|
2013-07-17 23:30:04 +08:00
|
|
|
|
2022-06-03 00:12:05 +08:00
|
|
|
# Do not renew this cert as it is used for legacy data decrypt test
|
2022-08-26 00:09:09 +08:00
|
|
|
#$OPENSSL ecparam -out ecp.pem -name P-256
|
2022-06-03 00:12:05 +08:00
|
|
|
#CN="Test S/MIME EE EC #3" $OPENSSL req -config ca.cnf -noenc \
|
|
|
|
# -keyout smec3.pem -out req.pem -newkey ec:ecp.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
#$OPENSSL x509 -req -in req.pem -CA smroot.pem -days 36524 \
|
|
|
|
# -extfile ca.cnf -extensions signer_cert -CAcreateserial >>smec3.pem
|
|
|
|
#rm ecp.pem req.pem
|
|
|
|
|
|
|
|
# Create X9.42 DH parameters and key.
|
2021-01-15 18:12:09 +08:00
|
|
|
$OPENSSL genpkey -genparam -algorithm DHX -out dhp.pem
|
2013-08-02 22:51:46 +08:00
|
|
|
$OPENSSL genpkey -paramfile dhp.pem -out smdh.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
rm dhp.pem
|
|
|
|
# Create X9.42 DH certificate with respective extensions
|
2022-08-27 02:40:48 +08:00
|
|
|
gen smdh.pem "/CN=Test SMIME EE DH" dh_cert >>smdh.pem
|
2022-08-26 00:09:09 +08:00
|
|
|
|
|
|
|
# EE RSA code signing end entity certificate with respective extensions
|
|
|
|
cp ../certs/ee-key.pem csrsa1.pem
|
2022-08-27 02:40:48 +08:00
|
|
|
gen csrsa1.pem "/CN=Test CodeSign EE RSA" codesign_cert >>csrsa1.pem
|