Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: tests/gen_test_keys.sh

Issue 4215006: Make dumpRSAPublicKey also accept a public key in PEM format (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: remove spurious key add Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/devkeys/create_new_keys.sh ('k') | utility/dev_make_keypair » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 # Generate test keys for use by the tests. 7 # Generate test keys for use by the tests.
8 8
9 # Load common constants and variables. 9 # Load common constants and variables.
10 . "$(dirname "$0")/common.sh" 10 . "$(dirname "$0")/common.sh"
(...skipping 14 matching lines...) Expand all
25 if [ -f "${key_base}.keyb" ]; then 25 if [ -f "${key_base}.keyb" ]; then
26 continue 26 continue
27 fi 27 fi
28 28
29 openssl genrsa -F4 -out ${key_base}.pem $i 29 openssl genrsa -F4 -out ${key_base}.pem $i
30 # Generate self-signed certificate from key. 30 # Generate self-signed certificate from key.
31 openssl req -batch -new -x509 -key ${key_base}.pem \ 31 openssl req -batch -new -x509 -key ${key_base}.pem \
32 -out ${key_base}.crt 32 -out ${key_base}.crt
33 33
34 # Generate pre-processed key for use by RSA signature verification code. 34 # Generate pre-processed key for use by RSA signature verification code.
35 ${UTIL_DIR}/dumpRSAPublicKey ${key_base}.crt \ 35 ${UTIL_DIR}/dumpRSAPublicKey -cert ${key_base}.crt \
36 > ${key_base}.keyb 36 > ${key_base}.keyb
37 37
38 alg_index=0 38 alg_index=0
39 for sha_type in ${sha_types[@]} 39 for sha_type in ${sha_types[@]}
40 do 40 do
41 alg=$((${key_index} * 3 + ${alg_index})) 41 alg=$((${key_index} * 3 + ${alg_index}))
42 # wrap the public key 42 # wrap the public key
43 vbutil_key \ 43 vbutil_key \
44 --pack "${key_base}.sha${sha_type}.vbpubk" \ 44 --pack "${key_base}.sha${sha_type}.vbpubk" \
45 --key "${key_base}.keyb" \ 45 --key "${key_base}.keyb" \
46 --version 1 \ 46 --version 1 \
47 --algorithm ${alg} 47 --algorithm ${alg}
48 48
49 # wrap the private key 49 # wrap the private key
50 vbutil_key \ 50 vbutil_key \
51 --pack "${key_base}.sha${sha_type}.vbprivk" \ 51 --pack "${key_base}.sha${sha_type}.vbprivk" \
52 --key "${key_base}.pem" \ 52 --key "${key_base}.pem" \
53 --algorithm ${alg} 53 --algorithm ${alg}
54 alg_index=$((${alg_index} + 1)) 54 alg_index=$((${alg_index} + 1))
55 done 55 done
56 key_index=$((${key_index} + 1)) 56 key_index=$((${key_index} + 1))
57 done 57 done
58 } 58 }
59 59
60 mkdir -p ${TESTKEY_DIR} 60 mkdir -p ${TESTKEY_DIR}
61 generate_keys 61 generate_keys
OLDNEW
« no previous file with comments | « tests/devkeys/create_new_keys.sh ('k') | utility/dev_make_keypair » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698