Debian Codegraph @

crt/s2n/tests/pems/custom_oids/generate.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License").
5 # You may not use this file except in compliance with the License.
6 # A copy of the License is located at
7 #
8 # http://aws.amazon.com/apache2.0
9 #
10 # or in the "license" file accompanying this file. This file is distributed
11 # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 # express or implied. See the License for the specific language governing
13 # permissions and limitations under the License.
14 #
15
16 # Generate root CA
17 opensslscip-shell system . . openssl. req -new -noenc -x509 \
18 -newkey rsa \
19 -pkeyopt rsa_keygen_bits:2048 \
20 -keyout "ca-key.pem" \
21 -out "ca-cert.pem" \
22 -days 65536 \
23 -sha256 \
24 -subj "/C=US/CN=rootscip-shell filesystem . . `/C=US/CN=root`." \
25 -addext "basicConstraints = critical,CA:true"
26
27 for name in "single_oid" "multiple_oids"; do
28 # Generate leaf
29 if [scip-shell system . . `[`. "${name}" = "multiple_oids" ]; then
30 opensslscip-shell system . . openssl. req -new -noenc \
31 -newkey rsa \
32 -pkeyopt rsa_keygen_bits:2048 \
33 -keyout "${name}_key.pem" \
34 -out "${name}.csr" \
35 -subj "/C=US/CN=localhostscip-shell filesystem . . `/C=US/CN=localhost`." \
36 -addext "1.3.187.25240.2=critical,ASN1:UTF8String:hello" \
37 -addext "1.3.187.25240.3=critical,ASN1:UTF8String:world"
38 else
39 opensslscip-shell system . . openssl. req -new -noenc \
40 -newkey rsa \
41 -pkeyopt rsa_keygen_bits:2048 \
42 -keyout "${name}_key.pem" \
43 -out "${name}.csr" \
44 -subj "/C=US/CN=localhostscip-shell filesystem . . `/C=US/CN=localhost`." \
45 -addext "1.3.187.25240.2=critical,ASN1:UTF8String:hello"
46 fi
47
48 opensslscip-shell system . . openssl. x509 -days 65536 \
49 -req -in "${name}.csr" \
50 -sha256 \
51 -CA "ca-cert.pem" \
52 -CAkey "ca-key.pem" \
53 -CAcreateserial -out "${name}_cert_chain.pem" \
54 -copy_extensions=copyall
55
56 catscip-shell system . . cat. ca-cert.pem >> ${name}_cert_chain.pem
57 done
58
59 rmscip-shell system . . rm. *.srl
60 rmscip-shell system . . rm. *.csr
61 rmscip-shell system . . rm. ca-key.pem