@@ -56,7 +56,7 @@ prompt = no
56
56
57
57
[ req_distinguished_name ]
58
58
O = $PROJECT_NAME
59
- CN = 127.0.0.1
59
+ CN = localhost
60
60
EOF
61
61
62
62
cat > device_cert.conf << EOF
70
70
71
71
# private key generation
72
72
openssl genrsa -out axTLS.ca_key.pem 2048
73
- openssl genrsa -out axTLS.key_512.pem 512
74
73
openssl genrsa -out axTLS.key_1024.pem 1024
75
- openssl genrsa -out axTLS.key_1042.pem 1042
76
74
openssl genrsa -out axTLS.key_2048.pem 2048
77
75
openssl genrsa -out axTLS.key_4096.pem 4096
78
76
openssl genrsa -out axTLS.device_key.pem 1024
79
- openssl genrsa -aes128 -passout pass:abcd -out axTLS.key_aes128.pem 512
80
- openssl genrsa -aes256 -passout pass:abcd -out axTLS.key_aes256.pem 512
81
-
77
+ openssl genrsa -aes128 -passout pass:abcd -out axTLS.key_aes128.pem 1024
78
+ openssl genrsa -aes256 -passout pass:abcd -out axTLS.key_aes256.pem 1024
82
79
83
80
# convert private keys into DER format
84
- openssl rsa -in axTLS.key_512.pem -out axTLS.key_512 -outform DER
85
81
openssl rsa -in axTLS.key_1024.pem -out axTLS.key_1024 -outform DER
86
- openssl rsa -in axTLS.key_1042.pem -out axTLS.key_1042 -outform DER
87
82
openssl rsa -in axTLS.key_2048.pem -out axTLS.key_2048 -outform DER
88
83
openssl rsa -in axTLS.key_4096.pem -out axTLS.key_4096 -outform DER
89
84
openssl rsa -in axTLS.device_key.pem -out axTLS.device_key -outform DER
90
85
91
86
# cert requests
92
87
openssl req -out axTLS.ca_x509.req -key axTLS.ca_key.pem -new \
93
88
-config ./ca_cert.conf
94
- openssl req -out axTLS.x509_512.req -key axTLS.key_512.pem -new \
95
- -config ./certs.conf
96
89
openssl req -out axTLS.x509_1024.req -key axTLS.key_1024.pem -new \
97
90
-config ./certs.conf
98
- openssl req -out axTLS.x509_1042.req -key axTLS.key_1042.pem -new \
99
- -config ./certs.conf
100
91
openssl req -out axTLS.x509_2048.req -key axTLS.key_2048.pem -new \
101
92
-config ./certs.conf
102
93
openssl req -out axTLS.x509_4096.req -key axTLS.key_4096.pem -new \
@@ -110,25 +101,32 @@ openssl req -out axTLS.x509_aes256.req -key axTLS.key_aes256.pem \
110
101
111
102
# generate the actual certs.
112
103
openssl x509 -req -in axTLS.ca_x509.req -out axTLS.ca_x509.pem \
113
- -sha1 -days 5000 -signkey axTLS.ca_key.pem
114
- openssl x509 -req -in axTLS.x509_512.req -out axTLS.x509_512.pem \
115
- -sha1 -CAcreateserial -days 5000 \
116
- -CA axTLS.ca_x509.pem -CAkey axTLS.ca_key.pem
104
+ -sha1 -days 5000 -signkey axTLS.ca_key.pem \
105
+ -CAkey axTLS.ca_key.pem
106
+ openssl x509 -req -in axTLS.ca_x509.req -out axTLS.ca_x509_sha256.pem \
107
+ -sha256 -days 5000 -signkey axTLS.ca_key.pem \
108
+ -CAkey axTLS.ca_key.pem
117
109
openssl x509 -req -in axTLS.x509_1024.req -out axTLS.x509_1024.pem \
118
110
-sha1 -CAcreateserial -days 5000 \
119
111
-CA axTLS.ca_x509.pem -CAkey axTLS.ca_key.pem
120
- openssl x509 -req -in axTLS.x509_1042.req -out axTLS.x509_1042.pem \
121
- -sha1 -CAcreateserial -days 5000 \
122
- -CA axTLS.ca_x509.pem -CAkey axTLS.ca_key.pem
112
+ openssl x509 -req -in axTLS.x509_1024.req -out axTLS.x509_1024_sha256.pem \
113
+ -sha256 -CAcreateserial -days 5000 \
114
+ -CA axTLS.ca_x509_sha256.pem -CAkey axTLS.ca_key.pem
115
+ openssl x509 -req -in axTLS.x509_1024.req -out axTLS.x509_1024_sha384.pem \
116
+ -sha384 -CAcreateserial -days 5000 \
117
+ -CA axTLS.ca_x509_sha256.pem -CAkey axTLS.ca_key.pem
118
+ openssl x509 -req -in axTLS.x509_1024.req -out axTLS.x509_1024_sha512.pem \
119
+ -sha512 -CAcreateserial -days 5000 \
120
+ -CA axTLS.ca_x509_sha256.pem -CAkey axTLS.ca_key.pem
123
121
openssl x509 -req -in axTLS.x509_2048.req -out axTLS.x509_2048.pem \
124
122
-sha1 -CAcreateserial -days 5000 \
125
123
-CA axTLS.ca_x509.pem -CAkey axTLS.ca_key.pem
126
124
openssl x509 -req -in axTLS.x509_4096.req -out axTLS.x509_4096.pem \
127
- -sha256 -CAcreateserial -days 5000 \
125
+ -sha1 -CAcreateserial -days 5000 \
128
126
-CA axTLS.ca_x509.pem -CAkey axTLS.ca_key.pem
129
127
openssl x509 -req -in axTLS.x509_device.req -out axTLS.x509_device.pem \
130
128
-sha1 -CAcreateserial -days 5000 \
131
- -CA axTLS.x509_512 .pem -CAkey axTLS.key_512 .pem
129
+ -CA axTLS.x509_1024 .pem -CAkey axTLS.key_1024 .pem
132
130
openssl x509 -req -in axTLS.x509_aes128.req \
133
131
-out axTLS.x509_aes128.pem \
134
132
-sha1 -CAcreateserial -days 5000 \
@@ -141,35 +139,33 @@ openssl x509 -req -in axTLS.x509_aes256.req \
141
139
# note: must be root to do this
142
140
DATE_NOW=` date`
143
141
if date -s " Jan 1 2025" ; then
144
- openssl x509 -req -in axTLS.x509_512 .req -out axTLS.x509_bad_before.pem \
142
+ openssl x509 -req -in axTLS.x509_1024 .req -out axTLS.x509_bad_before.pem \
145
143
-sha1 -CAcreateserial -days 365 \
146
144
-CA axTLS.ca_x509.pem -CAkey axTLS.ca_key.pem
147
145
date -s " $DATE_NOW "
148
146
touch axTLS.x509_bad_before.pem
149
147
fi
150
- openssl x509 -req -in axTLS.x509_512 .req -out axTLS.x509_bad_after.pem \
148
+ openssl x509 -req -in axTLS.x509_1024 .req -out axTLS.x509_bad_after.pem \
151
149
-sha1 -CAcreateserial -days -365 \
152
150
-CA axTLS.ca_x509.pem -CAkey axTLS.ca_key.pem
153
151
154
152
# some cleanup
155
153
rm axTLS* .req
156
- rm axTLS .srl
154
+ rm * .srl
157
155
rm * .conf
158
156
159
157
# need this for the client tests
160
158
openssl x509 -in axTLS.ca_x509.pem -outform DER -out axTLS.ca_x509.cer
161
- openssl x509 -in axTLS.x509_512.pem -outform DER -out axTLS.x509_512.cer
162
159
openssl x509 -in axTLS.x509_1024.pem -outform DER -out axTLS.x509_1024.cer
163
- openssl x509 -in axTLS.x509_1042.pem -outform DER -out axTLS.x509_1042.cer
164
160
openssl x509 -in axTLS.x509_2048.pem -outform DER -out axTLS.x509_2048.cer
165
161
openssl x509 -in axTLS.x509_4096.pem -outform DER -out axTLS.x509_4096.cer
166
162
openssl x509 -in axTLS.x509_device.pem -outform DER -out axTLS.x509_device.cer
167
163
168
164
# generate pkcs8 files (use RC4-128 for encryption)
169
- openssl pkcs8 -in axTLS.key_512 .pem -passout pass:abcd -topk8 -v1 PBE-SHA1-RC4-128 -out axTLS.encrypted_pem.p8
170
- openssl pkcs8 -in axTLS.key_512 .pem -passout pass:abcd -topk8 -outform DER -v1 PBE-SHA1-RC4-128 -out axTLS.encrypted.p8
171
- openssl pkcs8 -in axTLS.key_512 .pem -nocrypt -topk8 -out axTLS.unencrypted_pem.p8
172
- openssl pkcs8 -in axTLS.key_512 .pem -nocrypt -topk8 -outform DER -out axTLS.unencrypted.p8
165
+ openssl pkcs8 -in axTLS.key_1024 .pem -passout pass:abcd -topk8 -v1 PBE-SHA1-RC4-128 -out axTLS.encrypted_pem.p8
166
+ openssl pkcs8 -in axTLS.key_1024 .pem -passout pass:abcd -topk8 -outform DER -v1 PBE-SHA1-RC4-128 -out axTLS.encrypted.p8
167
+ openssl pkcs8 -in axTLS.key_1024 .pem -nocrypt -topk8 -out axTLS.unencrypted_pem.p8
168
+ openssl pkcs8 -in axTLS.key_1024 .pem -nocrypt -topk8 -outform DER -out axTLS.unencrypted.p8
173
169
174
170
# generate pkcs12 files (use RC4-128 for encryption)
175
171
openssl pkcs12 -export -in axTLS.x509_1024.pem -inkey axTLS.key_1024.pem -certfile axTLS.ca_x509.pem -keypbe PBE-SHA1-RC4-128 -certpbe PBE-SHA1-RC4-128 -name " p12_with_CA" -out axTLS.withCA.p12 -password pass:abcd
0 commit comments