Questions tagged [ecdh]

136 questions
17
votes
3 answers

Implement Diffie-Hellman key exchange in Java

I am trying to implement Diffie-Hellman key exchange in Java, but I'm having a hard time understanding the specification: Complete the Diffie-Hellman key exchange process as a local mechanism according to JWA (RFC 7518) in Direct Key Agreement mode…
Noureddine AMRI
  • 2,942
  • 1
  • 21
  • 28
12
votes
3 answers

Elliptic Curve Diffie Hellman in ios/swift

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
Zohar Etzioni
  • 691
  • 5
  • 14
7
votes
1 answer

how to import ECDH public key (Cannot create a key using the specified key usages)

I am trying to run code with webcrypto but cannot seem to import ECDH public key. What am I missing ? I get this error: cannot create a key using the specified key usages. Browser: Google Chrome Version 71.0.3578.98 (Official Build) (64-bit) (Works…
Anna B
  • 5,997
  • 5
  • 40
  • 52
7
votes
2 answers

How to uncompress a single X9.62 compressed point on an ECDH P256 curve in Go?

Golang's elliptical curve library can derive a secret key given a public coordinate with a X and Y value (uncompressed coordinates). However, when the point given is a single value in X9.62 compressed form with a given y-bit, how do I uncompress…
Brandon
  • 13,956
  • 16
  • 72
  • 114
5
votes
1 answer

Elliptic Curve Cryptography in React Native

Does anyone know if there is an implementation of Elliptic Curve Diffie Hellman cryptography (ECDH) for React Native? I found some libraries for this. each of them has some issues: react-native-ecc: it only generates key pairs and does not…
Emad Bayat
  • 177
  • 1
  • 2
  • 12
4
votes
1 answer

ios SecKeyCopyKeyExchangeResult sharedInfo parameters

Im trying to use the SecKeyCopyKeyExchangeResult function to obtain the shared secret from my local private key and received public key of server. Shared key is generated successfully and I able to decrypt incomming message with AES encryption Not…
Sergey Brazhnik
  • 661
  • 4
  • 13
4
votes
3 answers

ECDH between C# and javascript

I'm building a web API and I need to implement ECDH to perform an end-to-end cryptography. At the server side I have a C# application and at the client side I have a Javascript application. I'm able to exchange the keys, generate the private keys…
Harry
  • 41
  • 4
4
votes
1 answer

Encrypting data using elliptic curve encryption in ios/swift

I've been trying to encrypt a string with an elliptic curve encryption using Security swift library, and i'm getting an error on the line with SecKeyCreateEncryptedData(...) : Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0). I…
Dany
  • 339
  • 1
  • 3
  • 15
3
votes
2 answers

C# and Kotlin ECDH shared key mismatch

Deriving shared key using: C# ECDiffieHellmanCng.DeriveKeyMaterial(ECDiffieHellmanPublicKey otherPartyPublicKey) Kotlin KeyAgreement.generateSecret() followed by KeyAgreement.doPhase(key: Key!, lastPhase: Boolean) Yields different results using…
Sorhox
  • 43
  • 5
3
votes
1 answer

Java/Android - ECDH Encryption - Create ECPublicKey from String

I have a little problem with the ECDH (Elliptic-curve Diffie-Hellman) encryption. I use the BouncyCastle library. Here is my function to generate keys : public static KeyPair generateECKeys() { try { ECNamedCurveParameterSpec…
Insou
  • 1,303
  • 1
  • 13
  • 17
3
votes
1 answer

iOS - swift - Generating key pair for secp224k1 curve (ECDH)

I have been trying to generate public and private keys for the secp224k1 curve in iOS. We are using ECDH method to do api handshake between mobile and backend. In Java it is done using the below code. public static KeyPair getECKeyPair() throws…
jegadeesh
  • 875
  • 9
  • 22
3
votes
0 answers

Java (Android): Diffie-Hellman key exchange process according to JWA (RFC 7518)

I need to use ECDH key exchange process in order to encrypt/decrypt messages between the client and the server. I use jose4j library for cryptographic functionality. I have the local key pair (private dC and public QC), I have the remote public key…
Michael Kessler
  • 14,245
  • 13
  • 50
  • 64
3
votes
2 answers

ECDH with key in Android Key Store

I'm developping an Android App that generates an EC Asymetric key. When my app gets connected to a device, they exchange their public key. They then use ECDH to establish a shared secret. This shared secret is then used to derive an AES session key.…
OlivierGrenoble
  • 3,803
  • 2
  • 18
  • 25
3
votes
2 answers

Is ECIES a public encryption algorithm?

I've implemented RSA encryption algorithm to encrypt the symmetric key used in data encryption, but the key size and the ciphertext size of RSA created a memory issue, so I searched other methods of public key cryptography for the solution. I found…
srla
  • 71
  • 6
3
votes
1 answer

Encryption in swift using Security framework

I've been trying to encrypt and decrypt a string in swift using a Diffie Hellman key exchange and an elliptic curve encryption. But after the key exchange I can't restore a private key from a CFData shared1/shared2 variable for decryption. All i get…
Dany
  • 339
  • 1
  • 3
  • 15
1
2 3
9 10