keytool error: java.lang.Exception: Keystore file exists, but is empty

Delete the empty keystoreFile.txt, then run your 2nd command again [aniket@localhost bin]$ keytool -genkey -alias myKeyStore -keyalg RSA -keystore /home/aniket/keystore/keystoreFile.txt It’s trying to create the file you specify with the -keystore flag. The reason your first one command failed is that you gave it an existing directory name.

Warning: use -cacerts option to access cacerts keystore

It’s quite easy. If you check keytool manual you can see the following: $ keytool -importcert -help keytool -importcert [OPTION]… Imports a certificate or a certificate chain Options: … removed for clearity -cacerts access the cacerts keystore To get rid of that warning you must use -cacerts option instead of calling cacert keystore: keytool -import … Read more

Add password to keytool command

The keytool that ships with the Oracle JDK allows you to specify it on the command line with -storepass, you were doing keytool -help instead of keytool -list -help. (I suppose the Android version is the same.) C:\>keytool.exe -list -help keytool -list [OPTION]… Lists entries in a keystore Options: -rfc output in RFC style -alias … Read more

Programmatically Import CA trust cert into existing keystore file without using keytool

The following code inserts the CA cert file yourcert.cer into your keystore without using keytool: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.security.Key; import java.security.KeyStore; import java.security.cert.Certificate; import java.io.IOException; import java.io.InputStream; import java.io.DataInputStream; import java.io.ByteArrayInputStream; import java.security.spec.*; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.util.Collection; public class ImportCA { public static void main(String[] argv) throws Exception { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)