The default location is /Users/<username>/. android/debug. keystore.
On a Windows system, the location of the Java cacerts keystore is: install_dir \jre\lib\security\, and the location of the keytool is install_dir \jre\bin\.
Locate the keystore location in the JRE. Typically this keystore is at JAVA_HOME\jre\lib\security\cacerts. The keytool that is used to access the keystore is typically installed with the JRE and ready to use. Run the standard keytool to import the certificate, from JAVA_HOME\jre\lib\security.
Your keystore will be in your JAVA_HOME---> JRE -->lib---> security--> cacerts
. You need to check where your JAVA_HOME is configured, possibly one of these places,
Computer--->Advanced --> Environment variables---> JAVA_HOME
Your server startup batch files.
In your import command -keystore cacerts (give full path to the above JRE here instead of just saying cacerts).
Keystore Location
Each keytool command has a -keystore
option for specifying the name and location of the persistent keystore file for the keystore managed by keytool. The keystore is by default stored in a file named .keystore
in the user's home directory, as determined by the "user.home" system property. Given user name uName, the "user.home" property value defaults to
C:\Users\uName on Windows 7 systems
C:\Winnt\Profiles\uName on multi-user Windows NT systems
C:\Windows\Profiles\uName on multi-user Windows 95 systems
C:\Windows on single-user Windows 95 systems
Thus, if the user name is "cathy", "user.home" defaults to
C:\Users\cathy on Windows 7 systems
C:\Winnt\Profiles\cathy on multi-user Windows NT systems
C:\Windows\Profiles\cathy on multi-user Windows 95 systems
http://docs.oracle.com/javase/1.5/docs/tooldocs/windows/keytool.html
Mac OS X 10.12 with Java 1.8:
$JAVA_HOME/jre/lib/security
cd $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
From there it's in:
./jre/lib/security
I have a cacerts keystore in there.
To specify this as a VM option:
-Djavax.net.ssl.trustStore=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre/lib/security/cacerts -Djavax.net.ssl.trustStorePassword=changeit
I'm not saying this is the correct way (Why doesn't java know to look within JAVA_HOME?), but this is what I had to do to get it working.
You can find it in your "Home" directory:
On Windows 7:
C:\Users\<YOUR_ACCOUNT>\.keystore
On Linux (Ubuntu):
/home/<YOUR_ACCOUNT>/.keystore
This works for me:
#! /bin/bash CACERTS=$(readlink -e $(dirname $(readlink -e $(which keytool)))/../lib/security/cacerts) if keytool -list -keystore $CACERTS -storepass changeit > /dev/null ; then echo $CACERTS else echo 'Can not find cacerts file.' >&2 exit 1 fi
Only for Linux. My Solaris has no readlink. In the end I used this Perl-Script:
#! /usr/bin/env perl use strict; use warnings; use Cwd qw(realpath); $_ = realpath((grep {-x && -f} map {"$_/keytool"} split(':', $ENV{PATH}))[0]); die "Can not find keytool" unless defined $_; my $keytool = $_; print "Using '$keytool'.\n"; s/keytool$//; $_ = realpath($_ . '../lib/security/cacerts'); die "Can not find cacerts" unless -f $_; my $cacerts = $_; print "Importing into '$cacerts'.\n"; `$keytool -list -keystore "$cacerts" -storepass changeit`; die "Can not read key container" unless $? == 0; exit if $ARGV[0] eq '-d'; foreach (@ARGV) { my $cert = $_; s/\.[^.]+$//; my $alias = $_; print "Importing '$cert' as '$alias'.\n"; `keytool -importcert -file "$cert" -alias "$alias" -keystore "$cacerts" -storepass changeit`; warn "Can not import certificate: $?" unless $? == 0; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With