spongycastle

SpongyCastle: Error while finalizing cipher

删除回忆录丶 提交于 2020-01-15 09:40:14
问题 in an Android project I need to authenticate my app for an https connection. Using the following method I'm trying to decrypt my private key, provided by the server developers in a .pem file. I use SpongyCastle , and at the top of the same class where the methods are I already changed the security provider like this: static { Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); } In this case my object is an instance of PKCS8EncryptedPrivateKeyInfo . This is

SpongyCastle: Error while finalizing cipher

元气小坏坏 提交于 2020-01-15 09:40:05
问题 in an Android project I need to authenticate my app for an https connection. Using the following method I'm trying to decrypt my private key, provided by the server developers in a .pem file. I use SpongyCastle , and at the top of the same class where the methods are I already changed the security provider like this: static { Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); } In this case my object is an instance of PKCS8EncryptedPrivateKeyInfo . This is

How can I generate a valid ECDSA EC key pair?

半世苍凉 提交于 2019-12-31 02:45:29
问题 I am trying to generate ECDSA key pair using SpongyCastle in Android. This is the code: static { Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); } public static KeyPair generate() { ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("prime256v1"); KeyPairGenerator generator = KeyPairGenerator.getInstance("ECDSA", "SC"); generator.initialize(ecSpec, new SecureRandom()); KeyPair keyPair = g.generateKeyPair(); Log.i(TAG, "EC Pub Key generated: " +

Compare PublicKey object in java

不羁岁月 提交于 2019-12-30 04:58:27
问题 I have two PublicKey object.I want to compare both for equality or to check which is latest object using java security API or bouncy castle API.How can i achieve this? 回答1: You can use equals if (!key.equals(copyKey)){ System.out.println("not equals!"); } or check the hashcode of the keys if (key.hashCode() != copyKey.hashCode()) { System.out.println("public key hashCode check failed"); } or compare the hex string of the two public keys String encodedKey1 = new String(Hex.encode(key1

Android to server communication using SSL with Bouncy Castle

◇◆丶佛笑我妖孽 提交于 2019-12-28 06:26:50
问题 I understand this is something which is not so difficult but very unfortunately I am stuck here and fighting it since yesterday, I have followed this Mutual Authentication in Android tutorial, to place a keystore in resources and trying to connect to my server over SSL, but getting the following exception java.lang.RuntimeException: org.spongycastle.jcajce.provider.asymmetric.x509.CertificateFactory$ExCertificateException I have placed my sslapptruststore.pfx file under res/raw

Android : could not find org.spongycastle.util.io.pem.PemReader

前提是你 提交于 2019-12-25 15:51:03
问题 I am using spongycastle in my android code. code is working fine in android 5 and android 6 but in android 4 its showing the error : java.lang.NoClassDefFoundError: org.spongycastle.util.io.pem.PemReader Its failing at the time of initialization of PemReader in the below code : private PublicKey getPublicKey(AssetManager manager, String keyPath) { PublicKey key = null; try { final KeyFactory keyFactory = KeyFactory.getInstance(TicketVerifier.ENCRYPTION_ALGORITHM); InputStream stream = manager