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
4
votes
1 answer

Get Ephemeral key x and y coordinates

Using .NET Core 3.1, C#. I'm not very good with this crypto stuff at all. Can someone help me? How do I obtain the newly generated ephemeral public key X and Y bytes? [Edit: Got this working! See code below]. How do I generate a DerivedKeyMaterial…
PKCS12
  • 407
  • 15
  • 41
4
votes
0 answers

How to build a highly secure End to End Encryption React Native messaging app

I just posted this question on security stackexchange and they advised me to move my question to stackoverflow so here it is. I am currently working on an instant React Native messaging app and I want to implement E2EE (End to End Encryption between…
4
votes
1 answer

Generate shared secret key from Curve25519 (or X25519) asymmetric key pairs in node.js using crypto module

I am trying to create a shared secret key between Curve25519 (or X25519) asymmetric key pairs using key exchange algorithms just like Diffie Hellman key exchange. Diffie Hellman key exchange can be be done in node.js using crypto module in the…
4
votes
0 answers

C++ tutorial on Diffie Hellman

Is there a C++ tutorial for Diffie Hellman key exchange using OpenSSL? I keep searching and I can't find anything. If you know of a tutorial, I would be grateful for a link to it. Thank you.
Abanoub
  • 3,623
  • 16
  • 66
  • 104
4
votes
1 answer

Java Diffie hellman initialize ECDHKeyAgreement

I have a Diffie–Hellman security class like this: public class AESSecurityCap { private PublicKey publicKey; KeyAgreement keyAgreement; byte[] sharedsecret; AESSecurityCap() { makeKeyExchangeParams(); } private…
mah454
  • 1,571
  • 15
  • 38
4
votes
1 answer

ECDH private key size

I know that key sizes in ECDH depend on size of Elliptic Curve. If it is a 256-bit curve (secp256k1), keys will be: Public: 32 bytes * 2 + 1 = 65 (uncompressed) Private: 32 bytes 384-bit curve (secp384r1): Public: 48 bytes * 2 + 1= 97…
4
votes
0 answers

Failed to unwrap key exception android O on Diffie-Hellman encryption

I am using Diffie-Hellman encryption and decryption algorithm for my app username and password.I am using my keystore to store information and retrieving It is working properly working in below android O.Recently i am facing this issue please help…
skyshine
  • 2,767
  • 7
  • 44
  • 84
4
votes
1 answer

SSL key exchange encryption techniques

what are the differences between the three key exchange algortihms namely Anonymous DH, Ephermal DH and fixed DH?
Anish
  • 51
  • 1
  • 3
4
votes
1 answer

Cryptography Python: Diffie-Hellman key exchange implementation

Im currently trying to build an implementation of the Ephemeral Diffie-Hellman algorithm using the python cryptography module. It's important for our purposes that the users are authenticated. Both Alice and Bob have a public-private key pair and a…
jvermeulen
  • 505
  • 1
  • 6
  • 14
4
votes
3 answers

Generating Diffie-hellman parameters (generator)

I'm trying to implement a diffie-hellman key exchange. Let's say I found a large prime number p - how can I find a generator g? Restricted by the multiprecision library that I have to use, only a few basic operations (+, *, -, /, pow, modExp,…
user66875
  • 2,772
  • 3
  • 29
  • 55
4
votes
0 answers

java.security.InvalidKeyException when implementing DH protocol

In my android application I would like to implement the Diffie-Hellman protocol in order to generate a common secret between two users. What I do is the following: when the first user sends a friendship request to the second one, the app generates…
4
votes
2 answers

DHGEX failing with 2048-bit key under Java 8, but succeeding with 1024-bit key

I'm using JSCH 0.1.53 to connect to a remote SSH server, which uses a 1024-bit RSA key. We are able to connect successfully to the remote server when we also use a 1024-bit RSA key, but when we generated stronger 2048-bit keys we stopped being able…
Tim
  • 2,027
  • 15
  • 24
4
votes
1 answer

Java JVM Hotspot ephemeralDHKeySize

I am trying to increase the DH key size from 1024 bits to 2048 bits, as per this question: How to expand DH key size to 2048 in java 8. However, it does not seem to work. Relevant information: java -version java version "1.8.0_45" Java(TM) SE…
Michael
  • 363
  • 5
  • 20
4
votes
2 answers

python Diffie-Hellman standard library

Is there a standard library for python that implements Diffie-Hellman? I've taken a look at openssl wrapper in python pyopenssl and it doesn't cover it. I could not find it in NaCl or cryptography.io library either.
user3713847
4
votes
2 answers

How do I actually encrypt something with the Diffie-Hellman apis in nodejs?

I'm looking at the very simple demo in the nodejs crypto documentation here: https://nodejs.org/api/crypto.html#crypto_crypto_getdiffiehellman_group_name They very easily demonstrate how to get a shared secret... now what? How can I use said shared…
justin.m.chase
  • 13,061
  • 8
  • 52
  • 100