java-security

Java Keystore.getKey() slow while Key store size Increase

淺唱寂寞╮ 提交于 2019-12-02 03:50:13
I am using java key store to store and retrieve encryption key.It works faster while my key store size is small. But once my key store size is increased than key store operation goes slow. I am working on linux platform, Java version Jdk_1.8. and safenet as provider. I have been facing the same issue related to execution speed varies with different operation system platform. Jvm loads key store in memory. And its having hashtable collection as internal storage. Hashtable is synchronized. Whenever you perform get operation from key store, than it will return it from in-memory key store not from

Reading a PKCS#1 or SPKI public key in Java without libraries

孤街醉人 提交于 2019-12-01 11:06:53
I need to use a public key to verify some data in Java, but I can't seem to format the key in such a way that Java can use without third-party plugins. I'm generating the key with Node.js's crypto library, which gives me the option of PKCS#1 or SPKI , and either .pem or .der file format. I've heard that Java doesn't support PKCS#1 out-of-the box, and pretty much every other answer on StackOverflow recommends using BouncyCastle or similar, but in my case, I am writing an SDK, and simply cannot afford to use a library just to read this public key. So I'm currently reading the key in .der format

Sawtooth Invalid Batch or Signature

十年热恋 提交于 2019-12-01 06:41:54
I have started playing atound with Hyperledger Sawtooth recently, and having trouble to submit transactions on java, while python code seems okay. I have prepared the python code based on the api docs here and then tried to write one in java as well. Below is the code in java import com.google.protobuf.ByteString; import com.mashape.unirest.http.Unirest; import sawtooth.sdk.processor.Utils; import sawtooth.sdk.protobuf.*; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.Signature; import java.security.spec.ECGenParameterSpec; public class BatchSender {

Reading a PKCS#1 or SPKI public key in Java without libraries

一个人想着一个人 提交于 2019-12-01 05:38:47
问题 I need to use a public key to verify some data in Java, but I can't seem to format the key in such a way that Java can use without third-party plugins. I'm generating the key with Node.js's crypto library, which gives me the option of PKCS#1 or SPKI , and either .pem or .der file format. I've heard that Java doesn't support PKCS#1 out-of-the box, and pretty much every other answer on StackOverflow recommends using BouncyCastle or similar, but in my case, I am writing an SDK, and simply cannot

Sawtooth Invalid Batch or Signature

China☆狼群 提交于 2019-12-01 04:21:29
问题 I have started playing atound with Hyperledger Sawtooth recently, and having trouble to submit transactions on java, while python code seems okay. I have prepared the python code based on the api docs here and then tried to write one in java as well. Below is the code in java import com.google.protobuf.ByteString; import com.mashape.unirest.http.Unirest; import sawtooth.sdk.processor.Utils; import sawtooth.sdk.protobuf.*; import java.security.KeyPair; import java.security.KeyPairGenerator;

Restore RSA private key by modulus, public and private exponents using Java Security

落爺英雄遲暮 提交于 2019-12-01 00:20:33
I'm trying to find Java (native or BouncyCastle provider) implementation for generating a RSA private key in PKCS#1 using given params {e,n,d}. There is paper by Dan Boneh that describes an algorithm for doing so. The solution is available in PyCrypto (Python), as well as there is a standalone utility posted by Mounir IDRASSI that converts RSA keys between the SFM format (n,e,d) and CRT format (p,q,dp,dq,u), and the other way around. However I was not able to find anything ready to use for Java. Update: I found such implementation at https://github.com/martinpaljak/RSAKeyConverter/blob/master

Restore RSA private key by modulus, public and private exponents using Java Security

泄露秘密 提交于 2019-11-30 19:47:59
问题 I'm trying to find Java (native or BouncyCastle provider) implementation for generating a RSA private key in PKCS#1 using given params {e,n,d}. There is paper by Dan Boneh that describes an algorithm for doing so. The solution is available in PyCrypto (Python), as well as there is a standalone utility posted by Mounir IDRASSI that converts RSA keys between the SFM format (n,e,d) and CRT format (p,q,dp,dq,u), and the other way around. However I was not able to find anything ready to use for

JDK 11 SSL Error on valid certificate (working in previous versions)

六月ゝ 毕业季﹏ 提交于 2019-11-30 07:05:00
The following code throws an error in JDK 11: HttpURLConnection con = (HttpURLConnection) new URL("https://sis.redsys.es/sis/realizarPago").openConnection(); con.setRequestMethod("GET"); con.getResponseCode(); The error is: javax.net.ssl.SSLHandshakeException: extension (10) should not be presented in server_hello at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:128) at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:312) at java.base/sun.security.ssl.TransportContext.fatal

java.security.UnrecoverableKeyException: Failed to obtain information about private key

喜欢而已 提交于 2019-11-30 06:39:18
I have the following lines to get the private key from key store on Android KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); // generating key pair code omitted KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) this.keyStore.getEntry("alias", null); Everything works fine except that when the OS upgrades from Android 5.1.1 to Android 6.0.1, the 3rd line will throw java.security.UnrecoverableKeyException: Failed to obtain information about private key for very first execution. But it will work fine again afterward. Now my workaround is to

java.security.UnrecoverableKeyException: Failed to obtain information about private key

限于喜欢 提交于 2019-11-29 05:42:14
问题 I have the following lines to get the private key from key store on Android KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); // generating key pair code omitted KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) this.keyStore.getEntry("alias", null); Everything works fine except that when the OS upgrades from Android 5.1.1 to Android 6.0.1, the 3rd line will throw java.security.UnrecoverableKeyException: Failed to obtain information about