]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_ssl/regressions/gencerts.sh
Security-59306.120.7.tar.gz
[apple/security.git] / OSX / libsecurity_ssl / regressions / gencerts.sh
1 #!/bin/sh -x -e
2 CA_SUBJECT="/C=US/O=Apple Inc./OU=Secure Transport Test CA"
3 SERVER_SUBJECT="/C=US/O=Apple Inc./OU=Secure Transport Test Server/CN=localhost"
4 TRUSTED_CLIENT_SUBJECT="/C=US/O=Apple Inc./OU=Secure Transport Test Client (Trusted)/CN=localhost"
5 UNTRUSTED_CLIENT_SUBJECT="/C=US/O=Apple Inc./OU=Secure Transport Test Client (Untrusted)/CN=localhost"
6
7 openssl req -x509 -newkey rsa:1024 -sha1 -days 3650 -subj "$CA_SUBJECT" -nodes -keyout ca_key.pem -out ca_cert.pem
8 openssl req -x509 -newkey rsa:1024 -sha1 -days 3650 -subj "$UNTRUSTED_CLIENT_SUBJECT" -nodes -keyout untrusted_client_key.pem -out untrusted_client_cert.pem
9 openssl x509 -in cert-1.pem -out cert-1.der -outform DER
10 openssl rsa -in privkey-1.pem -out privkey-1.der -outform DER
11 openssl pkcs12 -export -passout pass:password -out identity-1.p12 -inkey privkey-1.pem -in cert-1.pem
12
13 xxd -i privkey-1.der privkey-1.h
14 xxd -i cert-1.der cert-1.h
15 xxd -i identity-1.p12 identity-1.h