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

Unified Diff: net/data/ssl/scripts/generate-keychain.sh

Issue 2411023002: *WIP* Mac Unittest for client cert selection with intermediate certs
Patch Set: rebase Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/data/ssl/scripts/generate-client-certificates-keychains.sh ('k') | net/ssl/client_cert_store_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/data/ssl/scripts/generate-keychain.sh
diff --git a/net/data/ssl/scripts/generate-keychain.sh b/net/data/ssl/scripts/generate-keychain.sh
index 4256cd9c81db227ea627b055cd42dbe334a03d81..c46c8a56b3cdd0d109c33c83f2666e825acab1fa 100755
--- a/net/data/ssl/scripts/generate-keychain.sh
+++ b/net/data/ssl/scripts/generate-keychain.sh
@@ -32,26 +32,36 @@ echo
$SECURITY create-keychain -p "$PASSWORD" "$KEYCHAIN"
-trusted=0
+mode=addcert
for cert in "$@"; do
+ if [ "$cert" = "--import" ]; then
+ mode=import
+ continue
+ fi
if [ "$cert" = "--trusted" ]; then
- trusted=1
+ mode=addtrustedcert
continue
fi
if [ "$cert" = "--untrusted" ]; then
- trusted=0
+ mode=addcert
+ continue
+ fi
+
+ if [ $mode = import ]; then
+ $SECURITY import "$cert" -A -k "$KEYCHAIN"
continue
fi
- # security tool only accepts DER. If input is a PEM, convert it.
+ # security tool add-trusted-cert and add-certificates only accepts DER. If
+ # input is a PEM, convert it.
if grep -- "-----BEGIN CERTIFICATE-----" "$cert" ; then
tmpcert="${cert}.der.tmp"
openssl x509 -inform PEM -in "$cert" -outform DER -out "$tmpcert"
cert="$tmpcert"
fi
- if [ $trusted = 1 ]; then
+ if [ $mode = addtrustedcert ]; then
$SECURITY add-trusted-cert -r trustAsRoot -k "$KEYCHAIN" "$cert"
else
$SECURITY add-certificates -k "$KEYCHAIN" "$cert"
« no previous file with comments | « net/data/ssl/scripts/generate-client-certificates-keychains.sh ('k') | net/ssl/client_cert_store_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698