java-security

Does X509TrustManagerImpl.checkServerTrusted() handle OCSP by itself if the appropriate properties are set?

我是研究僧i 提交于 2019-12-09 07:16:17
问题 public class CustomTrustManager implements X509TrustManager { private X509TrustManager trustManager; // If a connection was previously attempted and failed the certificate check, that certificate chain will be saved here. private Certificate[] rejectedCertificates = null; private Certificate[] encounteredCertificates = null; private KeyStore keyStore = null; private Logger logger; /** * Constructor * * @param loggerFactory * see {@link InstanceLoggerFactory} */ public CustomTrustManager

No subject alternative DNS name matching www.billiving.com found. Why this caused and how to solve?

泪湿孤枕 提交于 2019-12-08 12:37:03
问题 I have integration test suite for www.billiving.com API. when that API call endpoint should be https://www.billiving.com. my test suite work perfectly on windows. however when it move to ubuntu 14.x it get failed with following exception. [1] so i have written this [2] code to test it beyond the test suite. still it fail with same exception. so i tried to import billiving.com certificate to JKS but still it fail with same exception. i know as a solution we can override the verify method in

Java byte array to ECCPrivateKey - InvalidKeySpecException: encoded key spec not recognised

非 Y 不嫁゛ 提交于 2019-12-08 02:14:54
问题 When I try to make ECC private key from byte array, I get exception mentioned below. I have public/private keys and out signed output from C library micro-ecc/uECC.h. C used secp192r1 curve. I am trying to verify data with C generated keys in Java. How to convert byte array to private/public key? Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); byte[] kb = new byte[]{(byte)0x24, (byte)0xF4, (byte)0x36, (byte)0x16, (byte)0xD0, (byte)0x96, (byte)0x12, (byte)0x63,

How to Calculate Fingerprint From SSH RSA Public Key in Java?

不问归期 提交于 2019-12-07 14:11:55
问题 As title, How to Calculate Fingerprint From SSH RSA Public Key in Java? I got an rsaPublicKey object from sample.pub and I calculated the fingerprint by using library Apache Commons Codec DigestUtils.sha256Hex(rsaPublicKey.getEncoded()); But I got a different fingerprint when using ssh-keygen command ssh-keygen -E sha256 -lf sample.pub sample.pub as below ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAsuVPKUpLYSCNVIHD+e6u81IUznkDoiOvn/t56DRcutRc4OrNsZZ+Lmq49T4JCxUSmaT8PeLGS/IC946CNQzFwMh+

Java byte array to ECCPrivateKey - InvalidKeySpecException: encoded key spec not recognised

一世执手 提交于 2019-12-06 09:05:32
When I try to make ECC private key from byte array, I get exception mentioned below. I have public/private keys and out signed output from C library micro-ecc/uECC.h. C used secp192r1 curve. I am trying to verify data with C generated keys in Java. How to convert byte array to private/public key? Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); byte[] kb = new byte[]{(byte)0x24, (byte)0xF4, (byte)0x36, (byte)0x16, (byte)0xD0, (byte)0x96, (byte)0x12, (byte)0x63, (byte)0x90, (byte)0x2E, (byte)0x51, (byte)0xF6, (byte)0x87, (byte)0x55, (byte)0xAB, (byte)0xCB, (byte

Data signed on iOS can't be verified in Java

空扰寡人 提交于 2019-12-05 03:36:17
I have some data that I'm signing on iOS with SecKeyRawSign using Elliptic Curve private key. However, verifying that data in Java using Signature.verify() returns false The data is a random 64 bit integer, split into bytes like so uint64_t nonce = (some 64 bit integer) NSData *nonceData = [NSData dataWithBytes: &nonce length: sizeof(nonce)]; From that data I'm creating a SHA256 digest int digestLength = CC_SHA256_DIGEST_LENGTH; uint8_t *digest = malloc(digestLength); CC_SHA256(nonceData.bytes, (CC_LONG)nonceData.length, digest); NSData *digestData = [NSData dataWithBytes:digest length

Does X509TrustManagerImpl.checkServerTrusted() handle OCSP by itself if the appropriate properties are set?

烂漫一生 提交于 2019-12-03 09:11:00
public class CustomTrustManager implements X509TrustManager { private X509TrustManager trustManager; // If a connection was previously attempted and failed the certificate check, that certificate chain will be saved here. private Certificate[] rejectedCertificates = null; private Certificate[] encounteredCertificates = null; private KeyStore keyStore = null; private Logger logger; /** * Constructor * * @param loggerFactory * see {@link InstanceLoggerFactory} */ public CustomTrustManager(InstanceLoggerFactory loggerFactory) { try { this.logger = loggerFactory.getLogger(CustomTrustManager.class)

Convert .cer certificate to .jks

三世轮回 提交于 2019-12-02 17:30:58
I need to convert a .cer file to a .jks file. I saw a few questions about it, but haven't seen a solution to what I need. I don't need it in order to add it to my local certificates, but as a file to upload to a server. I also need to do it only once, and not programmatically. There's this thread Converting .cer to .jks using java and the author says he had done it successfully, but I couldn't comment to his last reply as I don't have enough reputation, nor could I send him a personal message and ask him. So if anyone knows of a simple way to do so, I'll be glad to hear. keytool comes with the

ECC private key is longer than public key

僤鯓⒐⒋嵵緔 提交于 2019-12-02 16:00:41
问题 I have generated ECC public and private key using secp192r1 curve. I get 75 for public and 125 for private encoded key array length. Why private key is longer than public key? Why private key is not longer two times than public? Why private key is not 192 bits = 24 bytes because of secp192r1? Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); ECNamedCurveParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("secp192r1"); KeyPairGenerator g = KeyPairGenerator

ECC private key is longer than public key

旧城冷巷雨未停 提交于 2019-12-02 07:44:51
I have generated ECC public and private key using secp192r1 curve. I get 75 for public and 125 for private encoded key array length. Why private key is longer than public key? Why private key is not longer two times than public? Why private key is not 192 bits = 24 bytes because of secp192r1? Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); ECNamedCurveParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("secp192r1"); KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC"); g.initialize(ecSpec, new SecureRandom()); KeyPair pair = g.generateKeyPair()