elliptic-curve

Rejecting class because it failed compile-time verification

社会主义新天地 提交于 2019-12-13 13:15:07
问题 I am trying to integrate curve25519-java from openwhispersystems into my Android app and compiling it with API 23 (Marshmallow). When using non native code I get this runtime exception: java.lang.VerifyError: Rejecting class org.whispersystems.curve25519.java.fe_mul because it failed compile-time verification (declaration of 'org.whispersystems.curve25519.java.fe_mul' appears in /data/app/com.fenritz.safecam-1/base.apk) at org.whispersystems.curve25519.java.ge_madd.ge_madd(ge_madd.java:65) at

ECDH secrets generated by BouncyCastle Java API and by OpenSSL are different

与世无争的帅哥 提交于 2019-12-13 00:09:23
问题 I'm trying to make use of elliptic curve crypto. I need two implementations of the same thing, one in Java and one in C. I'm testing them using two key pairs which were generated using the curve secp256k1 . When I generate the derived secret in Java I always get a different number from what I get from OpenSSL. Java code: /* privateKey and peerPublicKey are generated with the following parameters */ ECParameterSpec paramSpec = ECNamedCurveTable.getParameterSpec("secp256k1"); /* ... */ Provider

What is the padding type for Elliptic Curve Crypto

霸气de小男生 提交于 2019-12-12 18:24:44
问题 After SecKeyGeneratePair for ECC, I try to encrypt plaintext by the public key. SecKeyEncrypt returns -4(errSecUnimplemented). I am not sure about the padding type is correct. I tried all the types in my xcode, they don't work as well. Can somebody explain why SecKeyEncrypt returns -4? (NSData *)encrypt:(NSString *)plainTextString key:(SecKeyRef)publicKey { NSData *data = [plainTextString dataUsingEncoding:NSUTF8StringEncoding]; size_t encryptedDataLength = SecKeyGetBlockSize(publicKey);

Client ECC SSL Certificate contains “unknown named curve”

谁说我不能喝 提交于 2019-12-12 10:38:02
问题 Question precontext: I am working in an existing library that uses SSL with the netty framework on a remote server. I am running into an SSL/TLS handshake error. The error is as follows: javax.net.ssl.SSLProtocolException: java.io.IOException: Unknown named curve: 1.2.840.10045.3.1.1 at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1345) ~[na:1.7.0_79] at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:519) ~[na:1.7.0_79] at sun.security.ssl.SSLEngineImpl

Export EC private key from BouncyCastle and import into CngKey or ECDsaCng?

落花浮王杯 提交于 2019-12-12 10:10:34
问题 I have created key pairs for elliptic curve DSA signatures using BouncyCastle and managed to import the public key into ECDsaCng using an XMLString accoding to RFC4050. Now I want to also move the private key and have not managed to find a solution. The closest I have got is using CngKey.Import. CngKey.Import supports PKCS#8 format so if you can get your keys into valid pkcs8 then it should work. Unfortunately the following code does not quite work. var privatekey = (ECPrivateKeyParameters)

Can't bridge Elliptic Curve Diffie-Hellman with javascript

我们两清 提交于 2019-12-12 09:17:28
问题 I know this is a very specific question but I tried to exchange keys between php and a client using the Elliptic Curve Diffie-Hellman algorithm (ECDH) based on 2 libraries that seem sound: https://github.com/mdanter/phpecc for the php part and http://www-cs-students.stanford.edu/~tjw/jsbn/ecdh.html for the js part. It seems that the parameters (as can be seen at the second demo) just aren't right for the Mattias Danter library in (1)! What I tried: a. produce Alice public key in php b. take x

Does OpenSSL -sign for ECDSA apply ASN1 encoding to the hash before signing?

戏子无情 提交于 2019-12-12 05:38:56
问题 This SO question ECDSA sign using OpenSSL without ASN1 encoding the hash states the OpenSSL perfoms ASN1 encoding to the hash before signing it. In other words it states that OpenSSL performs the following steps when for an Elliptic curve key -sign is called: a. Calculate H = Hash(M) b. Encode H into ASN1 standard- H’ c. Sign H’ And thus to avoid applyting step b it's neccessary to first calculate the digest, and then sign the digest using raw signing - pkeyutl for elliptic curver keys

Can I create a JCE ECPublicKey from a Q value from an openssh public key and ECParameterSpec

瘦欲@ 提交于 2019-12-12 05:36:38
问题 I'm reading openssh format elliptic curve public keys (RFC 5656, section 3.1) and would like to get from a BigInteger Q value to an ECPublicKey instance using JCE (rather than say BouncyCastle). I want to do this to verify JWT signatures. e.g. https://api.github.com/users/davidcarboni/keys: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK8hPtB72/sfYgNw1WTska2DNOJFx+QhUxuV6OLINSD2ty+6gxcM8yZrvMqWdMePGRb2cGh8L/0bGOk+64IQ/pM= It looks like I can use ECPublicKeySpec .

How to convert ECDiffieHellmanPublicKey instance to DER file in .net framework?

末鹿安然 提交于 2019-12-11 18:48:38
问题 I have following code: ECDiffieHellman ecdh = ECDiffieHellman.Create(ECCurve.NamedCurves.nistP256); ECDiffieHellmanPublicKey ecdhPublic = ecdh.PublicKey; How can I export the ECDiffieHellmanPublicKey instance (ecdhPublic) into DER encoded file? 回答1: Using BouncyCastle (http://www.bouncycastle.org/) you can export your ECDH public key to a DER encoded ANS.1 Object X9ECParameters ecP = NistNamedCurves.GetByName("P-256"); ECDomainParameters ecSpec = new ECDomainParameters(ecP.Curve, ecP.G, ecP.N

How to convert public key to BigInteger

放肆的年华 提交于 2019-12-11 09:49:29
问题 I need to convert a public key into a BigInteger. In the code below I have extracted the private key and stored it as BigInteger . But when I followed the same method for the public it is not working. public static void main(String[] args) throws Exception { Security.addProvider(new BouncyCastleProvider()); BigInteger ZERO=new BigInteger("0"); int c; // ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("P-224"); ECCurve curve = new ECCurve.Fp( new BigInteger(