elliptic-curve

How to find the matching curve name from an ECPublicKey

情到浓时终转凉″ 提交于 2019-12-02 07:22:42
Currently i'm updating my x.509 certificate library to support ECC. Most of the builders that are implemented take a publicKey and derive the algorithm and such from the key. In RSA this is simple, you check the algorithm of the key and you can verify the bit length. However with ECC the key is based on a curve, and the curve name (of course) needs to be specified in the certificate (as OID). The issue i'm working on right now is finding a way to come from either a java.security.interfaces.ECPublicKey or a org.bouncycastle.jce.interfaces.ECPublicKey to a curve name. (Both implementations are

How to use ECC in iOS

柔情痞子 提交于 2019-12-01 15:47:30
Is there any example for use ECC in iOS? I noticed that the kSecAttrKeyTypeEC in Apple Developer Documents, but I can't use it to generic Key pair. Below code is modified from the example CryptoExercise // Container dictionaries. NSMutableDictionary * privateKeyAttr = [[NSMutableDictionary alloc] init]; NSMutableDictionary * publicKeyAttr = [[NSMutableDictionary alloc] init]; NSMutableDictionary * keyPairAttr = [[NSMutableDictionary alloc] init]; // Set top level dictionary for the keypair. [keyPairAttr setObject:(id)kSecAttrKeyTypeEC forKey:(id)kSecAttrKeyType]; [keyPairAttr setObject:

How to use ECC in iOS

泪湿孤枕 提交于 2019-12-01 15:23:29
问题 Is there any example for use ECC in iOS? I noticed that the kSecAttrKeyTypeEC in Apple Developer Documents, but I can't use it to generic Key pair. Below code is modified from the example CryptoExercise // Container dictionaries. NSMutableDictionary * privateKeyAttr = [[NSMutableDictionary alloc] init]; NSMutableDictionary * publicKeyAttr = [[NSMutableDictionary alloc] init]; NSMutableDictionary * keyPairAttr = [[NSMutableDictionary alloc] init]; // Set top level dictionary for the keypair.

Creating an ECC Private/Public key with native C#

安稳与你 提交于 2019-12-01 09:26:06
I've been looking around for hours on Google and Microsoft's Crypto API on how to generate a public and private ECC key pair. The ECDiffieHellmanCng Class ( http://msdn.microsoft.com/en-us/library/system.security.cryptography.ecdiffiehellmancng.aspx#Y3081 ) lists an example but I don't know how to access the private key directly. For a little background on the program, it's a C# console app for managing TrueCrypt sessions, AES pre-shared key encryption, and ECDH/AES encryption. I need a function to merely create a public/private key pair to save to files, then documentation of how to use those

Use previously generated private key in ECIES

你。 提交于 2019-12-01 06:26:23
I wan to encrypt /decrypt data using ECIES , I am using cryptopp for this. AutoSeededRandomPool prng; //get private key generated ECIES<ECP>::Decryptor d0(prng, ASN1::secp256r1()); PrintPrivateKey(d0.GetKey()); //get public key ECIES<ECP>::Encryptor e0(d0); PrintPublicKey(e0.GetKey()); //encrypt the message string em0; // encrypted message StringSource ss1 (message, true, new PK_EncryptorFilter(prng, e0, new StringSink(em0) ) ); //decrypt the message string dm0; // decrypted message StringSource ss2 (em0, true, new PK_DecryptorFilter(prng, d1, new StringSink(dm0) ) ); Everything else is fine

How to load PEM encoded Elliptic Curve public keys into Bouncy Castle?

时光怂恿深爱的人放手 提交于 2019-12-01 06:00:41
I have a PEM encoded Elliptic Curve public key that I'm trying to load into Bouncy Castle and everything I tried so far is failing. This is an example of the key I'm trying to load: -----BEGIN PUBLIC KEY----- MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBhsFCcWY2GaiN1BjPEd1v+ESKO6/0 D0sUR4y1amHnOr3FZx6TdqdoSBqxownQrnAKGCwagGxUb7BWwPFgHqKQJHgBq+J7 F+6m5SKAEL1wS5pqya91N7oudF3yFW8oZRE4RQRdSLl3fV2aVXKwGDXciwhUhw8k x5OS4iZpMAY+LI4WVGU= -----END PUBLIC KEY----- It is generated by NodeJS Crypto module and the curve name is secp521r1. It's later on encoded into PEM by the npm package key-encoder . I already

Use previously generated private key in ECIES

醉酒当歌 提交于 2019-12-01 04:51:43
问题 I wan to encrypt /decrypt data using ECIES , I am using cryptopp for this. AutoSeededRandomPool prng; //get private key generated ECIES<ECP>::Decryptor d0(prng, ASN1::secp256r1()); PrintPrivateKey(d0.GetKey()); //get public key ECIES<ECP>::Encryptor e0(d0); PrintPublicKey(e0.GetKey()); //encrypt the message string em0; // encrypted message StringSource ss1 (message, true, new PK_EncryptorFilter(prng, e0, new StringSink(em0) ) ); //decrypt the message string dm0; // decrypted message

How to load PEM encoded Elliptic Curve public keys into Bouncy Castle?

£可爱£侵袭症+ 提交于 2019-12-01 03:51:31
问题 I have a PEM encoded Elliptic Curve public key that I'm trying to load into Bouncy Castle and everything I tried so far is failing. This is an example of the key I'm trying to load: -----BEGIN PUBLIC KEY----- MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBhsFCcWY2GaiN1BjPEd1v+ESKO6/0 D0sUR4y1amHnOr3FZx6TdqdoSBqxownQrnAKGCwagGxUb7BWwPFgHqKQJHgBq+J7 F+6m5SKAEL1wS5pqya91N7oudF3yFW8oZRE4RQRdSLl3fV2aVXKwGDXciwhUhw8k x5OS4iZpMAY+LI4WVGU= -----END PUBLIC KEY----- It is generated by NodeJS Crypto module and the

Why is the ECC-DH Symmetric Key Of This Site Different From OpenSSL

别来无恙 提交于 2019-11-30 21:45:21
问题 I am using (this site's) Javascript library and OpenSSL Ruby to compute the symmetric key of Elliptic Curve Diffie Hellman. However, from my results, OpenSSL Ruby only generated one key unlike that on the site which has X and Y symmetric keys. I am baffled as my OpenSSL symmetric key doesn't match either one of those x and y on the site. The symmetric(shared secret) keys I got using secp224r1 curve: Ruby OpenSSL 13506351678569412185536677668115375188438201041599149052762191980775 Using Site's

Elliptic Curve Diffie Hellman in ios/swift

寵の児 提交于 2019-11-30 15:26:20
问题 Does iOS expose API for key generation, and secret key derivation using ECDH? From what I see, apple are using it (and specifically x25519) internally but I don't see it exposed as public API by common crypto or otherwise. Thanks, Z 回答1: Done in playground with Xcode 8.3.3, generates a private/public key using EC for Alice, Bob, then calculating the shared secret for Alice using Alice's private and Bob's public, and share secret for Bob using Bob's private and Alice's public and finally