Questions tagged [diffie-hellman]

Diffie-Hellman, commonly abbreviated DH, refers to a public key cryptographic protocol used by two parties to produce a common shared secret.

Diffie-Hellman, commonly abbreviated DH, refers to a public key cryptographic protocol used by two parties to produce a common shared secret.

It is most commonly used to implement key agreement, by using the properties of exponentiation modulo a large prime. Another variant uses the properties of elliptic curve groups and is commonly abbreviated ECDH.

For further reading see Wikipedia

431 questions
5
votes
3 answers

Using WebCrypto to generate ECDH key from PBKDF2

WARNING The following is not intended as an endorsement of converting passwords to ECDH keys. Create ECDH keys from high-entropy, crypto-safe PRNGs. I want to take a secret and generate a ECDH public/private key from it. In the browser, a usual…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
5
votes
2 answers

.NET ECDiffieHellmanCng and BouncyCastle Core compatible agreement

I have to make a Diffie Hellman agreement with a third party that communicates the public keys in the .NET ECDiffieHellmanCng XmlString format. I cannot change their code. What they send looks like this:
user968698
  • 429
  • 3
  • 14
5
votes
2 answers

Choosing a encryption key from Diffie-Hellman output

I implemented Diffie–Hellman key exchange in Java with some large groups from RFC 3526. My output is a fairly large array of bytes. Is it safe to use the first 448 bits (56 bytes) of the output for a blowfish key? Should I transform the bytes in any…
Eric Lathrop
  • 1,338
  • 11
  • 18
5
votes
2 answers

Generating Large Prime Numbers for Diffie-Hellman in Ruby

I'm writing an implementation of a diffie-hellman key exchange in ruby for a project for one of my university classes. I need to generate large (secure) prime numbers of at least 500 bits length. Any ideas? Should I use the OpenSSL library? If so,…
Jarsen
  • 7,432
  • 6
  • 27
  • 26
5
votes
1 answer

How does Elliptic Curve Diffie Hellman work on JavaCard, in combination with Java?

I'm trying to get Elliptic Curve Diffie Hellman to work on a JavaCard (version 2.2.1). On the JavaCard, I have the following code right now: byte temp[] = new byte[100]; byte secret[] = new byte[100]; byte size =…
kokx
  • 1,706
  • 13
  • 19
5
votes
1 answer

How to decrypt HTTPS (ECDHE) data?

I am trying to understand how exactly HTTPS works and doing a little practical tests. I have a data captured from HTTPS communication encrypted by TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA. If I understood it right, client during the TLS handshake creates…
user10099
  • 1,345
  • 2
  • 17
  • 23
5
votes
1 answer

How does the elliptic-curve version of Diffie-Hellman cryptography work?

Does the Elliptic curve diffie hellman calculation look any different from the standard one defined here: /* * The basic Diffie-Hellman Key Agreement Equation * * The client initiates …
cmaduro
  • 1,672
  • 3
  • 21
  • 40
5
votes
2 answers

Generate EC Diffie-Hellman public and private key pair

I need to generate an EC Diffie Hellman key pair. I am using the secp256r1 named curve, and OpenSSL. This is what I have with me so far: unsigned char *ecdh(size_t *secret_len) { EVP_PKEY_CTX *pctx, *kctx; EVP_PKEY_CTX *ctx; unsigned…
5
votes
4 answers

Java Diffie-Hellman key exchange

I'm trying to execute code to perform the Diffie-Hellman key exchange. I sourced the code from an example online (forget where now). I had to import the bouncycastle.jar, which I assumed worked up until execution. my code: package…
Simon.
  • 1,886
  • 5
  • 29
  • 62
5
votes
2 answers

How to Export Private Key For ECDiffieHellmanCng

I am trying to export the keys from a new instance of a ECDiffieHellmanCng object so I can create an instance of it later with the same keys. But I am getting an error when trying to export it. //Create new ECDiffieHellmanCng which automatically…
Kevin Junghans
  • 17,475
  • 4
  • 45
  • 62
5
votes
1 answer

How to do Diffie Hellman Key Generation and retrieve raw key bytes in Java

I am writing a test harness in java for an existing program. As part of this i need to generate a Diffie Hellman key pair and pass the public key to the other program in its raw (i.e unencoded bytes) form. I can successfully the key pair using the…
5
votes
1 answer

Why isn't the key equal using OpenSSL diffie hellman?

I can't figure out why my keys aren't equal when doing this diffie hellman exchange example. I'm using the openssl library in C (openssl/dh.h). It seems pretty straightforward, but for some reason the keys aren't the same. What am I missing? Any…
4
votes
2 answers

How to exploit Diffie-hellman to perform a man in the middle attack

Im doing a project where Alice and Bob send each other messages using the Diffie-Hellman key-exchange. What is throwing me for a loop is how to incorporate the certificate they are using in this so i can obtain their secret messages. From what I…
jfisk
  • 6,125
  • 20
  • 77
  • 113
4
votes
1 answer

I'm using Wincrypt for Diffie-Hellman-- can I export the shared secret in plain text?

OK-- thanks to Mike, I was able to get Wincrypt to generate a Diffie-Hellman keypair. I figured out out to export the public key, and how to import the other party's public key. According to the docs, upon import of the other party's public key,…
Michael
4
votes
1 answer

Determining a Private Key (Diffie-Hellman)

I've been given a challenge and it has to do with testing a friend's encryption process. It's a Diffie-Hellman exchange process, and here are the known variables / constants: P, G my generated private key (variable) my generated public…
Jayson
  • 41
  • 1
  • 2
1 2
3
28 29