Questions tagged [jks]

A Java KeyStore (JKS) is a repository of cryptographic keys and certificates - used for instance in TLS encryption. It is defined within the Java Cryptography Architecture specification.

The file extension jks commonly refers to a Java keystore as defined in the Java Cryptography Architecture (JCA) specification. This file structure is used to hold bare keys, personal certificates and public certificates for use by Java-based applications.

The Java JDK references two different jks files. One, called the Trust Store holds the trusted certificates, such as the signer certificates issued by a Certificate Authority, or the personal certificates issued by peer nodes. Because all the certificates in the trust store are the public portion of the certificate pairs they represent, the security requirements for this file are significantly lower than those for private certificates and keys. The primary risk is to ensure secure provisioning to prevent insertion of undesired certificates. However, there is little to no risk in the file being world readable.

Separating the keystore and trust store files allows for the trust store to be distributed as part of an application's configuration package. The default location for this file is [jre home]/lib/security/cacerts.

Note that although this file is called a trust store to distinguish it from the keystore that holds the private keys, it uses the jks format and file name extension.

The second file referenced by the JDK is the keystore that contains the application's personal certificate and private keys, if any. Because these elements are private, they are usually generated in place in the local filesystem or hardware security module, and then never moved.

Managing the private keys and personal certificates centrally and then deploying them creates an additional security risk. If the central repository is breached, all certificates are compromised at once. When the certificates are transported improperly, it is possible to leave images of them in temp files, memory, cache and the local filesystems. For these reasons central management of private crypto elements is best performed by a purpose built Public Key Infrastructure (PKI) management system. A well-built PKI uses many additional controls to mitigate risks of breach and of leakage in transit.

JDKs provide a utility named keytool to manipulate the keystore and the cryptographic assets that it contains. The keytool utility includes functions to generate keys, generate certificate signing requests, import and export keys and certificates, and delete keys and certificates from the keystore.

497 questions
19
votes
1 answer

'JKS not found' when trying GoogleNetHTTPTransport

I've been having some troubles with Google Authorization and I've never worked with any "Google credentials-involved" process before. My problem takes place after I've created the credential reader (which I assume means that I could access my…
Juanse Hevia
  • 191
  • 1
  • 4
18
votes
4 answers

Where to store Android KeyStore file for CirlceCi build?

I am trying to configure continuous integration build for my Android app. I use CircleCi platform for it. Now I store my apps Keystore.jks file locally, but CircleCi needs it to sign my app. How can I achieve that without storing the file on my git…
bleo
  • 219
  • 2
  • 8
18
votes
1 answer

Unable to import .p12 keystore

I created a .p12 keystore using openssl from a pkcs8 keystore. Now I'm trying to import the private key using java Keytool into a new JKS keystore. I tried the command: keytool -importkeystore -srckeystore newKS.p12 -srcstoretype pkcs12 …
Amir_Af
  • 576
  • 6
  • 22
18
votes
1 answer

Is it possible to create JKS keystore file without a password?

I'm experimenting with OSGi conditional permissions mechanism. More specifically, I'm trying to use org.osgi.service.condpermadmin.BundleSignerCondition to restrict which bundles can be started. Documentation I have states that in order to use this…
Alex
  • 185
  • 1
  • 2
  • 6
17
votes
5 answers

How to solve "Key was created with errors:"

The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore -destkeystore -deststoretype pkcs12" I am getting this type of error with…
Govind
  • 171
  • 1
  • 1
  • 4
17
votes
1 answer

Difference between Entry Type "keyEntry" and "trustedCertEntry" in a keystore

I don't have much knowledge in this area, but i have still tried to do things by googling. Here is the problem i am facing. Case 1(Works): I have a CA signed certificate and i would like to use it in my Web Application. I first created a keystore. I…
bluefoggy
  • 961
  • 1
  • 9
  • 23
16
votes
3 answers

How to import x509.pem pk8 file into jks-keystore?

I have already tried to use the command keytool -import -keystore *.jks -alias alias_name -keypass alias_passwd -file *.x509.pem` (no *.pk8 file) but when I use the jks to sign the APK, a trusted certificate entries are not…
Fang
  • 3,652
  • 4
  • 16
  • 30
14
votes
3 answers

Convert CA-signed JKS keystore to PEM

I have a JKS keystore with certicate signed by CA. I need to export it in PEM format in order to use it with nginx. I need to do it in such a way that it includes the whole chain, so that my client can verify the signature. If I do something…
Konrad Garus
  • 53,145
  • 43
  • 157
  • 230
14
votes
1 answer

RSA JWT key rotation period?

I have created a basic JWT generator but need advice on a couple of aspects. I have been using JWT.io 's guides and the auth0/java-jwt libraries/repo to produce the tokens. The JWTs are being signed with 2 different keys. The refresh tokens are…
Jcov
  • 2,122
  • 2
  • 21
  • 32
14
votes
1 answer

Convert .keystore to .jks to sign apk

I have an android app that I am trying to protect using quixxi.com however it requires me to sign the app again. But to do this it has to use .jks files but my keystore is .keystore I am using Xamarin.Android in C# with Visual Studio 2017 Is there…
Ciaran
  • 199
  • 1
  • 2
  • 14
13
votes
7 answers

Kafka SSL handshake failed issue

I am trying to enable SSL Authentication on my Kafka server. I am following 7.2 section in the Kafka documentation. Followed all steps, but while calling the producer.bat file to send data in to the topic i get below error. ERROR [Producer…
Osman Jabri
  • 131
  • 1
  • 1
  • 3
13
votes
3 answers

Is there a way to make keytool not prompt for password for the key?

I am trying to generate a keystore. I have set a password for the keystore but I am trying to not set a password for the key. keytool -storepass "$password" -keystore ${PFX_broker}server.keystore.jks -alias $brokerCertAlias -validity $validity…
Dikshant Adhikari
  • 664
  • 1
  • 10
  • 24
13
votes
2 answers

What is the purpose of a .jks keystore?

I've been asked to create a jks keystore based on a certificate we had created. I've read a bit on the topic, but I'm still confused on a few items: Is the private key of a certificate supposed to be stored in a .jks keystone? If yes - where does…
user6448130
12
votes
3 answers

Attributes reversed in certificate subject and issuer

I am trying to generate X509 certificates with bouncycastle 1.46, with the code below. The issue I have is that when a certificate is written in a JKS and then reread, the DNs are reversed. For instance, if I run the code below, I get the following…
Maurice Perry
  • 32,610
  • 9
  • 70
  • 97
12
votes
3 answers

Why is fingerprint different in my newly signed apk?

I'm having an issue getting the same fingerprint after I changed the type of keystore from PKCS12 to JKS. In order to make the change I created a new JKS keystore, deleted the key that was in it, and imported the key I need from the .p12 file. When…
Jimbo145
  • 133
  • 8
1
2
3
33 34