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
0
votes
0 answers

Convert PKCS#12 Certificate to JKS format and save the certificate in JKS format with the help of JAVA

I have been stuck in a situation where i have a Keystore.jks in my configuration folder. Now from GUI i have to add a certificate+key in P12 format and store this certificate in Keystore.jks. When a user add the certificate then passphrase is also…
0
votes
1 answer

JKS file - do I need key-store?

I have JKS file and need to compile app. But I don't have keystore file from original computer. Is it possible to compile signed app with this JKS? And is there any app which checks whether I am using the right password for this JKS file?
peter
  • 4,289
  • 12
  • 44
  • 67
0
votes
2 answers

How to generate or import keys into your keystore?

I need to import a .p12 file into a .jks certificate and in this question it says that I need to import entries into the keystore, but actually I'm not understanding what entries do I have to import and in which keystore I need to do that. Why…
cagoscra
  • 19
  • 7
0
votes
1 answer

remove keyManager bean in securityContext file?

How can I remove the keyManager bean in securityContext.xml and the jks file ? I don't really need it to generate the metadata of my Service Provider. Thanks.
0
votes
1 answer

SSL client (soapUI) isn't responding with a certificate to the servers CertificateRequest

I'm trying to test a webservice using soapUI. The first step is setting up an secured connection. When I use a normal Java Keystore(JKS) everything works alright. However, when I convert the keystore to a bouncycastle keystore, I get the following…
Tosjo
  • 1
  • 5
0
votes
3 answers

Generate signed APK after update Android Studio

I have really strange problem. Years ago I write an App which was written in Eclipse. Then I upgraded to Android Studio 0.4.3 Everything was work correctly but now I delete this AS and work with new version (Android Studio 141.xxxx). The problem…
Eliasz Kubala
  • 3,836
  • 1
  • 23
  • 28
0
votes
1 answer

Keytool creates key with wrong password

The problem I'm having with Jetty not liking my Java Keystore boils down to this, I think: Generate a new keystore (I've included the password for clarity): keytool -keystore mark.jks -alias markkey -genkey -keyalg RSA Enter keystore password:…
Mark Smith
  • 880
  • 1
  • 8
  • 25
0
votes
1 answer

Importing cert and pkey to jks file

We have an application1 that is working with openssl and have a pkey and cert file (RSA) that clients are able to connect (handshake complete). We have another application2 that does not use openssl but Java keytool and jks file. Client are not able…
kande
  • 196
  • 1
  • 5
  • 18
0
votes
1 answer

How to correct generate signature using rsa private key with java?

I'm new in crypto with Java and I have a simple question. I have JKS keystore with SHA1withRSA trusted private key and certificate and I need to generate PKCS#7 signature for SOAP message. I tried found some info about this and at the moment, I have…
Giymose
  • 201
  • 1
  • 6
  • 21
0
votes
1 answer

Java - Standalone SSL Web Service - JAX-WS, JRE, no web server

I've developed a simple Web Service using wsgen and it works fine under http (non-SSL). I now need to get it working under https (SSL). I followed the code located here. So the SSL process runs right now...I'm running as a Java Application from…
lincolnadym
  • 909
  • 1
  • 12
  • 29
0
votes
1 answer

Not able to access Private key from PKCS12 file using java

I have created a pkcs12 file having a private key entry without any password. I am able to access the p12 file using keytool utility without providing any password. The same I am not able to to programmatically. When I am trying like below if(…
swagat
  • 353
  • 3
  • 6
0
votes
1 answer

Access private key used for signing my APK through the code

I have a signed APK. What I want to do is, access the private key and sign (encrypt) some message using it. Is it possible to access this private key through my code in run time? Any sample code to do the same?
Shivv
  • 65
  • 2
  • 11
0
votes
1 answer

Is there a way to extract a certificate from an etoken

Is there a way to extract a certificate from an etoken programmatically using java? If so, can it be converted to a Java KeyStore(.jks) file? This is my code String alias; SunPKCS11 sunpkcs11; Key privateKey; String cfgFile =…
Vin
  • 148
  • 2
  • 15
0
votes
1 answer

getting private key from keystore

I have .cer which is signed by others. from that i create private key file.jks using below tool. keytool -importcert -file aaa.cer -keystore aaa.jks -alias abcd Output: Owner: CN=Sample, EMAILADDRESS=hello@gmail.com, C=IN, OU=Director,…
Rajesh Narravula
  • 1,433
  • 3
  • 26
  • 54
0
votes
2 answers

import encrypted private key to jks

I need use ssl(2 way handshake) socket for connection in my project. So for creating keys, i used openssl with this comands : for server : req -x509 -days 3650 -nodes -newkey rsa:2048 -keyout a_private.key -out a_certificate.cert rsa -in…
Ardeshir Ayati
  • 113
  • 1
  • 5