OLD | NEW |
| (Empty) |
1 #!/bin/sh | |
2 | |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 # This script is used to generate the test keys for the unit test in | |
8 # android/keystore_unittest.c. | |
9 # | |
10 # These are test RSA / DSA / ECDSA private keys in PKCS#8 format, as well | |
11 # as the corresponding DSA / ECDSA public keys. | |
12 # | |
13 | |
14 # Exit script as soon a something fails. | |
15 set -e | |
16 | |
17 mkdir -p out | |
18 rm -rf out/* | |
19 | |
20 # Generate a single 2048-bits RSA private key in PKCS#8 format. | |
21 KEY=android-test-key-rsa | |
22 openssl genrsa \ | |
23 -out out/$KEY.pem \ | |
24 2048 | |
25 | |
26 # Generate a 2048-bits DSA private key in PKCS#8 format, | |
27 # as well as its public key in X.509 DER format. | |
28 KEY=android-test-key-dsa | |
29 openssl dsaparam \ | |
30 -out out/$KEY.param.pem \ | |
31 2048 | |
32 | |
33 openssl gendsa \ | |
34 -out out/$KEY.pem \ | |
35 out/$KEY.param.pem | |
36 | |
37 openssl dsa \ | |
38 -in out/$KEY.pem \ | |
39 -outform PEM \ | |
40 -out out/$KEY-public.pem \ | |
41 -pubout | |
42 | |
43 rm out/$KEY.param.pem | |
44 | |
45 # Generate an ECDSA private key, in PKCS#8 format, | |
46 # as well as its public key in X.509 DER format. | |
47 KEY=android-test-key-ecdsa | |
48 openssl ecparam -genkey -name prime256v1 -out out/$KEY.pem | |
49 | |
50 openssl ec \ | |
51 -in out/$KEY.pem \ | |
52 -outform PEM \ | |
53 -out out/$KEY-public.pem \ | |
54 -pubout | |
55 | |
56 # We're done here. | |
OLD | NEW |