OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # Generate test keys for use by the tests. |
| 8 |
| 9 KEY_DIR=testkeys |
| 10 key_lengths=( 1024 2048 4096 8192 ) |
| 11 UTIL_DIR=../utils/ |
| 12 |
| 13 # Generate RSA test keys of various lengths. |
| 14 function generate_keys { |
| 15 for i in ${key_lengths[@]} |
| 16 do |
| 17 openssl genrsa -F4 -out ${KEY_DIR}/key_rsa$i.pem $i |
| 18 # Generate self-signed certificate from key. |
| 19 openssl req -batch -new -x509 -key ${KEY_DIR}/key_rsa$i.pem \ |
| 20 -out ${KEY_DIR}/key_rsa$i.crt |
| 21 # Generate pre-processed key for use by RSA signature verification code. |
| 22 ${UTIL_DIR}/dumpRSAPublicKey ${KEY_DIR}/key_rsa$i.crt \ |
| 23 > ${KEY_DIR}/key_rsa$i.keyb |
| 24 done |
| 25 } |
| 26 |
| 27 if [ ! -d "$KEY_DIR" ] |
| 28 then |
| 29 mkdir "$KEY_DIR" |
| 30 fi |
| 31 |
| 32 generate_keys |
OLD | NEW |