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

OpenSSL Diffie Hellman DER Encoding in C

I have a problem and spent the last two days searching for an answers. I generated a DH Object with OpenSSL in C (more specific Objective-C, but I think there isn't something like that) and now can access the p,q and publickey values that are…
JulianM
  • 2,540
  • 18
  • 13
3
votes
2 answers

Public-Key Cryptography for Secret Key Distribution vs. Diffie–Hellman

Let's say we have a Server with a private and public key, the latter available to all Clients and we have a Client who doesn't have any asymmetrical keys of his own. We want to establish secure communication between the Server and the Client and the…
3
votes
1 answer

Why do we need Diffie Hellman?

Diffie–Hellman offers secure key exchange only if sides are authenticated. for authentication, sides are using public/private key. so if side A knows the public key of the side B, then A can simply use that key to encrypt the message (or the new…
piotrek
  • 13,982
  • 13
  • 79
  • 165
2
votes
1 answer

Windows CNG ECDH Secret Agreement structure

I've spent a few days by searching what structure does ECDH secret agreement have, but no success. I found in MSDN that the NCryptSecretAgreement function sets a pointer to an NCRYPT_SECRET_HANDLE variable that receives a handle that represents the…
wilkexx
  • 113
  • 1
  • 7
2
votes
0 answers

How is the numeric value obtained through Diffie-Hellman key exchange used?

I'm trying to implement the TLS handshake for specific cypher suits with Java so I chose simple DH as a key-exchange algorithm I have successfully completed the key exchange algorithm, and I don't understand how this number is actually used. I chose…
Jinwoo An
  • 23
  • 4
2
votes
2 answers

Length of Diffie-Hellman Elliptic Curve Private Key

I am using the FIPS 186-3 recommended curves for Diffie-Hellman Elliptic Curves. I'm trying to determine the max length of the private keys, according to RFC 5915 it should be: ceiling (log2(n)/8) ,where n is the order of the curve For the P-256…
lanzlord
  • 101
  • 6
2
votes
1 answer

node js https minDHSize not closing connection

I am making an https request to a server that supplies a 2048 bit Diffie-Hellman cipher, and trying to get my code to reject the connection and issue a handshake failure back to the server and close the connection. I don't think its used, but I have…
FlexDash
  • 35
  • 4
2
votes
1 answer

Generate a Java compatible Diffie-Hellman using Python

I am trying to rewrite the following code in Python. The original code is written in Javascript using the sjcl library. // Inputs var serverPubX = "WIUBDotrk02Rk/apL11jQPbmX0quyaYz2EIkGUlVf7s="; var serverPubY =…
Cesar Canassa
  • 18,659
  • 11
  • 66
  • 69
2
votes
1 answer

Diffie-Hellman key exchange between Python and Node fails with error Supplied key is too large

I'm trying to do a DH key exchange between the Python 3.6 client and the Node server running in Docker container with the latest node image (Node version: v13.10.1). I'm using cryptography.io (2.9.2) library on the python client side. The client…
Pavisa
  • 102
  • 7
2
votes
1 answer

Where does the 2048-bit part in Diffie-Hellman key exchange refer to?

I have consulted various sources about Diffie-Hellman Key Exchange algorithm, and I have understood the logic behind its operation. However, I have seen the expression "Diffie-Hellman 2048-bit key exchange", and I have a bit of hard time to…
avakas
  • 69
  • 6
2
votes
1 answer

iOS Swift Diffie-Hellman key exchange to encrypt and decrypt messages? using Secure Enclave

How can i use the Diffie-Hellman key exchange to encrypt and decrypt messages? I'am able to generate the shared keys (for both bob and alice) but SecKeyCopyKeyExchangeResult returns me a Data...how can i get SecKey to use with…
Fabiosoft
  • 1,141
  • 14
  • 32
2
votes
1 answer

Understanding Diffie-Hellman with NodeJS

// node.js 0.5 Diffie-Hellman example var crypto = require("crypto"); // the prime is shared by everyone var server = crypto.createDiffieHellman(512); var prime = server.getPrime(); // sharing secret…
user820955
  • 81
  • 1
  • 6
2
votes
2 answers

How to generate a certificate with DH parameters

I need to support Diffie Hellman encryption, now in order to test this i need to create a certificate with DH key parameters eg. key-length - 2048 etc. Now as i understand DH doesn't work with self-signed certificates, so basically i need to create…
2
votes
1 answer

ECDiffieHellman - mbedTLS vs C#

I need to use elliptic curve Diffie Hellman between a ARM cortex M3 and the PC. On the ARM, I use mbed TLS. On the PC side I want to us C# and the ECDiffieHellman(Cng) class. I can do the ECDH on ARM vs ARM, but I do have trouble when I try to…
Traummaennlein
  • 474
  • 5
  • 12
2
votes
1 answer

Get X.509 Certificate ECDH private and public key on Android (Java/Kotlin)

I'm currently trying to implement a ECDH algorithm in my android app. But I'm facing an issue, I would like to store the private and public key in Android KeyStore. However in order to achieve this I need to get a certificate for my keyPair. And…