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

Unified Diff: net/data/ssl/scripts/generate-android-test-keys.sh

Issue 11571059: Add net/android/keystore.h (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: address marcus' nits. Created 7 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/data/ssl/certificates/android-test-key-rsa.pem ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/data/ssl/scripts/generate-android-test-keys.sh
diff --git a/net/data/ssl/scripts/generate-android-test-keys.sh b/net/data/ssl/scripts/generate-android-test-keys.sh
new file mode 100755
index 0000000000000000000000000000000000000000..1c297e3a86fc3ff6064e40e58c3ef5704efb1e09
--- /dev/null
+++ b/net/data/ssl/scripts/generate-android-test-keys.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This script is used to generate the test keys for the unit test in
+# android/keystore_unittest.c.
+#
+# These are test RSA / DSA / ECDSA private keys in PKCS#8 format, as well
+# as the corresponding DSA / ECDSA public keys.
+#
+
+# Exit script as soon a something fails.
+set -e
+
+mkdir -p out
+rm -rf out/*
+
+# Generate a single 2048-bits RSA private key in PKCS#8 format.
+KEY=android-test-key-rsa
+openssl genrsa \
+ -out out/$KEY.pem \
+ 2048
+
+# Generate a 2048-bits DSA private key in PKCS#8 format,
+# as well as its public key in X.509 DER format.
+KEY=android-test-key-dsa
+openssl dsaparam \
+ -out out/$KEY.param.pem \
+ 2048
+
+openssl gendsa \
+ -out out/$KEY.pem \
+ out/$KEY.param.pem
+
+openssl dsa \
+ -in out/$KEY.pem \
+ -outform PEM \
+ -out out/$KEY-public.pem \
+ -pubout
+
+rm out/$KEY.param.pem
+
+# Generate an ECDSA private key, in PKCS#8 format,
+# as well as its public key in X.509 DER format.
+KEY=android-test-key-ecdsa
+openssl ecparam -genkey -name prime256v1 -out out/$KEY.pem
+
+openssl ec \
+ -in out/$KEY.pem \
+ -outform PEM \
+ -out out/$KEY-public.pem \
+ -pubout
+
+# We're done here.
« no previous file with comments | « net/data/ssl/certificates/android-test-key-rsa.pem ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698