Questions tagged [ecdh]
136 questions
2
votes
1 answer
Rust ECDH does not produce the same shared secret as NodeJS/Javascript and C implementations
I have ECDH shared secrets (sec1 and sec2, below) working in NodeJS/Javascript:
let sk1 = crypto.createECDH('secp256k1')
sk1.setPrivateKey(Buffer.from("71179b991d7693de813aeaa5bfa241a2ac9e0535867ebf8f6b1b0884472ef4a7", "hex"));
let pk1 =…

fadedbee
- 42,671
- 44
- 178
- 308
2
votes
1 answer
ECDSA KeyPair to Perform ECDH Shared Secret Encryption
I needed to be able to take an ECDSA keypair (private and public key) to then perform an ECDH to get a shared secret between two parties.
In this case we are talking about Alice and Bob. I could not find any relevant C# examples anywhere and where…

mathis1337
- 1,426
- 8
- 13
2
votes
1 answer
How to convert ECDH keys to PEM format with NodeJS crypto module
I want to have only one pair of keys that I can use for ECDH functions and for other function in node:crypto module.
I know there are two ways how to generate keys with node:crypto module.
One way is to use crypto.generateKeyPairSync. This generates…

David Novák
- 1,455
- 2
- 18
- 30
2
votes
2 answers
(C#) Calculate key share using private key and public key on (EC)DHE x25519
I am working with (EC)DHE encryption type x25519 and I have a big problem on calculating shared key.
I have three key:
Alice’s private key:
a : "984a382e1e48d2a522a0e81b92fd13517e904316c6687a59d66cd2e5d9519a53"
Alice’s public key:
Q(a) = a*G(a) :…

Kom Pe
- 35
- 5
2
votes
1 answer
Is it necessary to have two coordinates for the public key of ECDSA?
I am trying to generate an ECDSA key-pair using an external library called easy-ecc. The thing that I do not understand is this library generates a single coordinate for public key. As far as I see from books, online ECDSA generators or NIST test…

Terminou
- 49
- 6
2
votes
1 answer
ECDH for P-521 (Web Crypto Api) / secp521r1 (NodeJS Crypto) generate a slightly different shared secret
I have generated a public and private key pair with ECDH from NodeJS
function _genPrivateKey(curveName = "secp384r1", encoding = "hex") {
const private_0 = crypto.createECDH(curveName);
private_0.generateKeys();
return…

jay
- 1,453
- 1
- 11
- 30
2
votes
0 answers
Create secKey form data/hex/bytes using SecKeyCreateWithData give nil
I'm new to encryption. i want to create public seckey from data but i always get nil. Please help me. I need this public key as seckey to create a shared secrete key but i always get nil . how i can convert data to seckey?
Below are the code for…

Sourav Mishra
- 501
- 4
- 21
2
votes
0 answers
How Create 64 byte public and 32 byte private key Using ECDH encryption swift?
I have to protect my lock from MITM (i.e man in the middle attack). For that i have to integrate ECDH encryption. I have no knowledge related to this. Please help me how do i create 64 bytes public and 32 byte private key. below are the code i'm…

Sourav Mishra
- 501
- 4
- 21
2
votes
1 answer
Elliptic Curve Diffie Hellman public key size
I want to use Diffie hellman for generating a secret key between a c# Server and c++ Client. this code generates a public key for the server:
serverECDH = new ECDiffieHellmanCng(ECCurve.NamedCurves.nistP256);
…

fjahan
- 113
- 4
- 10
2
votes
1 answer
Encryption in swift using Diffie Hellman key exchange and an elliptic curve encryption
I've been trying to encrypt and decrypt a string in swift using a Diffie Hellman key exchange and an elliptic curve encryption.
Following is the code that I followed.
SWIFT Code :
let attributes: [String: Any] = [kSecAttrKeySizeInBits as String:…

user7413163
- 205
- 1
- 4
- 15
2
votes
1 answer
NIST p256 Point Decompression: Finding Y-Coordinate For Base Point
I'm trying to implement NIST P256 point compression and decompression and I keep getting the wrong y coordinate when I solve y = sqrt(x^3 + ax + b).
I figured a good test of the decompression would be to take the base point G defined by…

TheSocraticParadox
- 23
- 3
2
votes
0 answers
Implementing ECDH engine in OpenSSL 1.1.1
I am trying to write an OpenSSL Engine with ECDH support.
I am following this page on the OpenSSL wiki : https://wiki.openssl.org/index.php/Creating_an_OpenSSL_Engine_to_use_indigenous_ECDH_ECDSA_and_HASH_Algorithms.
However it is based on version…

runnenolleb
- 21
- 2
2
votes
0 answers
how to convert a String to an ECDH PublicKey and check its connectness
I'm using Java with Bouncy Castle to convert a server-side string_1 to ECDH PublicKey, then convert the PublicKey to string_2 to check the code's correctness, but string_1 and string_2 are different and I don't know where's wrong.
String key…

fanreson
- 21
- 2
2
votes
1 answer
Protection of an ECC Key in an Android Application
I have done an Android Application using an ECC Key pair. When I have developed it last year, I wanted to create the ECC key in the Android Keystore. Unfortunately, this ECC key is used to generate a session key thanks to ECDH, and ECDH is not…

OlivierGrenoble
- 3,803
- 2
- 18
- 25
2
votes
1 answer
openssl 1.0.2j, how to force server to choose ECDH* ciphers
I have client server which uses opensl 1.0.2j, and using RSA:4096 key and certificate and want to force the server to use only the following…

Naga
- 487
- 2
- 7
- 23