keystore

How to build a SSLSocketFactory from PEM certificate and key without converting to keystore?

删除回忆录丶 提交于 2019-12-03 03:37:05
I'm given a self-signed client certificate kit that is to be used to access a server via HTTPS. The kit consists of the following PEM files: client.crt (client certificate) client.key (client private key) ca.crt (CA certificate) One way to solve the task is to generate a Java keystore: Use openssl to convert client certificate and key to PKCS12 keystore Use keytool to import CA certificate to the store ... and then use code like the following to build SSLSocketFactory instance: InputStream stream = new ByteArrayInputStream(pksData); KeyStore keyStore = KeyStore.getInstance("PKCS12"); keyStore

java sending keystrokes using robot class

时光总嘲笑我的痴心妄想 提交于 2019-12-03 03:28:26
I know it's possible to send keystrokes in java using Robot Class , but is there any way to specify the target process when it's already started ? The Robot will send the keystrokes to whichever application window is on top. To send keystrokes to a specific target, you will want to set the target as the platform's foreground window first. Doing this may require native code such as that provided by JNI or (what I use) JNA. If you desire to send keystrokes to a background window, I believe that you cannot use Robot, that you will have to write native code. Of course all native code solutions

When to install keystore & when to install only certificate wrapped in keystore [duplicate]

孤街醉人 提交于 2019-12-03 03:12:25
This question already has an answer here: Truststore and Keystore Definitions 6 answers I have a PKCS#12 file which I considered as a keystore file since it contains one key entry & one certificate entry . In Android, I see people programmatically install keystore in the following way (The code is from Android developer blog ): byte[] keystore = . . (read from a PKCS#12 keystore) Intent installIntent = KeyChain.createInstallIntent(); installIntent.putExtra(KeyChain.EXTRA_PKCS12, keystore); startActivityForResult(installIntent, INSTALL_KEYSTORE_CODE); I also see people programmatically install

Android KeyStore private exponent cannot be extracted

谁说我不能喝 提交于 2019-12-03 02:42:00
I want to generate a RSA keypair in the Android Keystore. Since Android 4.3 is should be possible to generate RSA keys in the Android system Keystore. I generate my RSA key by (works fine) Calendar notBefore = Calendar.getInstance(); Calendar notAfter = Calendar.getInstance(); notAfter.add(1, Calendar.YEAR); KeyPairGeneratorSpec spec = new KeyPairGeneratorSpec.Builder(ctx) .setAlias("key") .setSubject( new X500Principal(String.format("CN=%s, OU=%s", "key", ctx.getPackageName()))) .setSerialNumber(BigInteger.ONE) .setStartDate(notBefore.getTime()) .setEndDate(notAfter.getTime()).build();

Load MSCAPI Java Keystore without loading private keys (hard token)

早过忘川 提交于 2019-12-03 02:23:33
I would like to load a MSCAPI keystore within Java and examine available certificates in the MY store. However some keys for those certificates reside on hardware tokens and a popup asks for the token during load. Is there a way to defer loading the private keys when loading the Windows keystore? keyStore = KeyStore.getInstance("Windows-MY", "SunMSCAPI"); keystore.load(null,null); The popup is being activated from the MS-CAPI Cryptographic Service Provider (CSP) - the DLL supplied by the USB token manufacturer - which finally communicates to the token through a driver (also supplied by the

How to generate keystore and truststore

跟風遠走 提交于 2019-12-03 01:25:12
How to: Generate keystore Generate truststore To make SSL work between client and server, I need help in only Generation of keystore and truststore for mutual authentication step-by-step guide with terminal commands(Keytool and openssl). I followed This link . 1.Generate keystore(At server): keytool -genkey -alias bmc -keyalg RSA -keystore KeyStore.jks -keysize 2048 2.Generate new ca-cert and ca-key: openssl req -new -x509 -keyout ca-key -out ca-cert 3.Extracting cert/creating cert sign req(csr): keytool -keystore KeyStore.jks -alias bmc -certreq -file cert-file 4.Sign the “cert-file” and cert

How do I get into a non-password protected Java keystore or change the password?

假装没事ソ 提交于 2019-12-03 00:39:14
问题 I'm trying to import a trusted certificated into the Java cacerts keystore, but I have a problem. I tried to list existing trusted certificates and it seems that the keystore isn't password protected. $ keytool -list -keystore cacerts Enter keystore password: ***************** WARNING WARNING WARNING ***************** * The integrity of the information stored in your keystore * * has NOT been verified! In order to verify its integrity, * * you must provide your keystore password. * **********

keytool import certificate java.util.IllegalFormatConversionException in linux

空扰寡人 提交于 2019-12-02 23:08:42
I am tring to create a keystore to be used in tomcat but I get the error "java.util.IllegalFormatConversionException: d != java.lang.String" using keytool. This happens only in linux (centos7) but not in windows. I created the keystore with keytool -genkey -keyalg RSA -alias client -keystore testkeystore -storepass mypassword -validity 3650 and tried to import the certificate with keytool -import -alias arubaauth -trustcacerts -keystore testkeystore -file root_autenticazione_ATe.cer The same commands and the same certificate do not show any error in windows. What is wrong? Thanks in advance I

Android - Encode & Decode RSA with Private Key?

本小妞迷上赌 提交于 2019-12-02 21:18:00
I am trying to encode and decode Strings on Android using a Private Key generated and stored using the Android Key Store Provider that was introduced in Android 4.3 I can successfully generate and get the private key using the following code: private void generatePrivateKey(Activity context, String alias){ /** Generate a new entry in the KeyStore by using the * KeyPairGenerator API. We have to specify the attributes for a * self-signed X.509 certificate here so the KeyStore can attach * the public key part to it. It can be replaced later with a * certificate signed by a Certificate Authority

keytool -genkey error: Keystore file does not exist

落花浮王杯 提交于 2019-12-02 20:55:39
I try to create a new self certified keystore file The command I use is: keytool -genkey -selfcert -dname "cn=My Name, ou=Orga unit" -alias selfcertified -keypass somepass -keystore keystore.jks -storepass anotherpass -validity 365 but I always get this annoying error: keytool error: java.lang.Exception: Keystore file does not exist: keystore.jks I do not understand why I'm getting this error. The command above should create a new keystore, so why is it complaining about a non existing store? Generating a key pair (and a new keystore) has to be done as a separate operation to creating a self