keystore

AndroidKeyStore KeyPairGenerator Crashes On Small Number of Devices

混江龙づ霸主 提交于 2019-12-04 01:47:05
My application only targets Android 6.0+. In my application I generate a RSA key in the AndroidKeyStore with the following: KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore"); kpg.initialize(new KeyGenParameterSpec.Builder( "myKey", KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT) .setCertificateSubject(new X500Principal("CN=myKey")) .setDigests("SHA-1") .setEncryptionPaddings("OAEPPadding") .build()); KeyPair kp = kpg.generateKeyPair(); This works well on 20+ devices that we have tested and nearly 100% percent of our users. However, there is a small

How to specify outbound certificate alias for HTTPS-calls?

萝らか妹 提交于 2019-12-03 22:59:12
I am calling a webservice that requires client certificate authentication. If I specify a Java keystore containing a single certificate (the client certificate the service expects) then everything works fine. However if I use a keystore that contains multiple certificates then I can't seem to be able to specify which certificate should be picked up by the client, the client seems to pick up the first available certificate (in alphabetical order). I have tried the following property but without expected result: System.setProperty("com.sun.enterprise.security.httpsOutboundKeyAlias", "my-client

Using two private keys (keystore) and two public keys (truststore) in one SSL Socket Connection

*爱你&永不变心* 提交于 2019-12-03 22:00:26
I need to use to key-pair in one socket ssl connection without change nothing in clients. Why? Because one client use a CN attribute in trust store for connection handshake and other clients using another value in the same attribute to process the same task in the same way. So I need to use two key store (private) with distinct CN attributes and also aliases and share two different trust store (public key) with distinct CN attributes and also aliases too. Describing bellow: keyStore1 Keystore type: JKS Keystore provider: SUN Alias name: identity1 Owner: CN=app1 ... Issuer: CN=app1 ...

I lost my keystore, I can't upgrade my app in the market

混江龙づ霸主 提交于 2019-12-03 18:11:38
问题 I upload my first app into market, and now I want to upgrade a new version, but I got this exception when I upgrade my app. " The apk must be signed with the same certificates as the previous version." I lost my certificate keystore, what can I do in this situation? unpublish my app and rename the package? Can I upload other app using the other keystore? 回答1: Faced the same problem. I was trying to restore it via deleted files restoring tools, but it failed. So, there is no other way: you

Java 7 (acting as client) SSL handshake failure with keystore and truststore that worked in Java 6

微笑、不失礼 提交于 2019-12-03 17:31:08
问题 I'm doing a JBoss AS 5.1 to 7.4, and Java 6 to 7 migration, and get a handshake failure. The keystore and truststore are the ones we have been using successfully for ages with Java 6. I've written some tests to narrow the problem down, it's definitely not JBoss but rather Java 7. With SSL logging turned on, I get this: 17:44:30,041 INFO [stdout] (http-/192.168.147.20:8080-120) %% Invalidated: [Session-2, SSL_RSA_WITH_RC4_128_SHA] 17:44:30,041 INFO [stdout] (http-/192.168.147.20:8080-120) http

Storing AES Secret key using keystore in java

一世执手 提交于 2019-12-03 15:53:29
I am using Java keystore to store the secret key for AES encryption. final String strToEncrypt = "Hello World"; KeyGenerator kg = KeyGenerator.getInstance("AES"); kg.init(128); SecretKey sk = kg.generateKey(); String secretKey = String.valueOf(Hex.encodeHex(sk.getEncoded())); //Storing AES Secret key in keystore KeyStore ks = KeyStore.getInstance("JCEKS"); char[] password = "keystorepassword".toCharArray(); java.io.FileInputStream fis = null; try { fis = new java.io.FileInputStream("keyStoreName"); ks.load(fis, password); } finally { if (fis != null) { fis.close(); } KeyStore

Load Java KeyStore for one alias?

谁说胖子不能爱 提交于 2019-12-03 15:50:09
Does anyone know if it is possible to load a KeyStore so that it only prompts for the password for the given alias? Example: In my key store i have two private keys: Alice's Encryption Certificate and Bob's Encryption Certificate. When i load my key store: keyStore = KeyStore.getInstance("Windows-MY", "SunMSCAPI"); keyStore.load(null); I am prompted for both Alice's and Bob's key store password. Once they are entered i can use getKey("Alice's Encryption Certificate", null); to retrieve Alice's private key. My keys are protected by Entrust's Security Provider, it is who prompts me for the

How to get KeyStore from usb token in Java

梦想与她 提交于 2019-12-03 14:56:42
问题 I have a SafeNet 5100 eToken already with a valid certificate in it that I use to access a web application from my company that requires it (multi-factor authentication). I'm creating a desktop application to access this website. I am already able to add the website's certificate to the TrustStore and get my certificate into a KeyStore . What I've got so far is: System.setProperty("javax.net.ssl.trustStore", "U:\\Certificados\\efau.truestore"); System.setProperty("javax.net.ssl.trustStoreType

SSLHandshakeException: Trust anchor for certification path not found. Only on Android API < 19

 ̄綄美尐妖づ 提交于 2019-12-03 14:28:26
I'm having issues with the https connection to a server with a self signed certificate on devices < api 19. I followed this guide published by android for trusting self-signed certifcates Android SSL and it seems to work fine with all the api>19 devices i tested. How ever i keep getting the "Trust anchor for certification path not found" error on pre 19. I've created the keystore using keytool and doesn't seem to be the problem because is working on some devices. This is my code: URL url_uri = new URL(url); AssetManager am = context.getAssets(); InputStream caInput = am.open("certs/myCert.bks"

cannot connect to server using BKS keystore

寵の児 提交于 2019-12-03 13:50:04
问题 I my android application am using SSL for client authentication and I am using BKS format keystore and MyHttpClient class looks as below, public class MyHttpClient extends DefaultHttpClient { final Context context; public MyHttpClient(Context context) { this.context = context; } @Override protected ClientConnectionManager createClientConnectionManager() { SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); //