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
2 answers

How to use BouncyCastle's Diffie-Hellman in C#?

I'm writing an app that'll exchange data between a phone and a Windows PC, and I want to protect the data sent with key generated with a Diffie-Hellman exchange. I'm trying to use BouncyCastle for that, but the almost non-existant documentation for…
Léster
  • 1,177
  • 1
  • 17
  • 39
4
votes
1 answer

Javacard KeyAgreement differs from BouncyCastle KeyAgreement

My problem looks like this. I have generated keys on the card and the terminal sides. I have on the terminal side the card public and private keys and the terminals public and private keys, and the same on the card side (i'm doing tests so thats why…
TajnosAgentos
  • 167
  • 1
  • 1
  • 10
4
votes
2 answers

Is it possible to "hack" Diffie-Hellman by knowing the prime number and the generator parameters?

I am trying to understand the Diffie-Hellman (DH) algorithm because I would like to have two computers communicating with each other but without a third one knowing what they are saying, but also exchanging the secret key they will use in an…
PedroD
  • 5,670
  • 12
  • 46
  • 84
4
votes
1 answer

Getting ECPoint/ECPublicKeyParameters from byte[] in Bouncy Castle

So far I've managed to generate a ECDHE pair in bouncy castle's lightweight API. However I have issues trying to recreate the public key from an byte[]. Since the ECPublicKeyParameters object only has one method getQ() I am assuming thats all that…
4
votes
4 answers

Diffie-Hellman Private Key

I have the line of code below to generate a private key: int Xa = randomNo.nextInt(10000); int Ya = (int) Math.pow(G, Xa) % P; G and P are static numbers. Whereas Xa is randomly generated. Every time I run the program, it gives me the same result…
Adam Hinx
  • 215
  • 3
  • 21
4
votes
1 answer

Performance of Bouncy Castle in Java

I'm having some problems with performance using the Bouncy Castle Provider when generating DH parameters. Anyone knows why the Bouncy Castle example below is about 50 times slower than using the standard provider? Using Bouncy Castle…
user1813904
  • 43
  • 1
  • 4
3
votes
1 answer

Zend_Crypt_DiffieHellman - example of usage

Is there an example of usage Zend_Crypt_DiffieHellman class? I'm trying to write a desktop application which will comunicate with PHP server on Zend Framework in a secure manner. I'm stuck with understading how I can establish a shared key between…
Ertai
  • 1,735
  • 2
  • 23
  • 29
3
votes
1 answer

OpenSSL gost engine issue

I'm trying to implement ECDH key exchange GOST 34.10-2001 using OpenSSL 1.0.0d. I'm loading gost engine like this: ENGINE * e = ENGINE_by_id("gost"); if(!e) { e = ENGINE_by_id("dynamic"); if (!e) { …
3
votes
0 answers

Using Bouncycastle to Perform Diffie-Hellman Key Exchange between Java and .NET

I want to use bouncycastle in order to perform Diffie-Hellman key exchange between two software components (Alice and Bob). Alice and Bob have their own key pair, issued from the same CA. However, Alice will be Java and Bob will be C#. I've…
John Ruiz
  • 2,371
  • 3
  • 20
  • 29
3
votes
2 answers

continued encryption with diffie-hellman shared key

I'm currently working on a protocol, which uses Diffie-Hellman for an key exchange. I receive a packet, which consists of an aes-128 encrypted part and a 128 Bit DH Public Key. In a very last step in the protocol, the aes key is sent to another peer…
evildead
  • 4,607
  • 4
  • 25
  • 49
3
votes
4 answers

Securing an android application

I have 'secured' the communication between my android application and a tls server providing a financial transaction service, currently in development. The security credentials are stored in a BKS keystore included in the Android apk. The password…
J0hnG4lt
  • 4,337
  • 5
  • 24
  • 40
3
votes
0 answers

Dart: PointyCastle export Diffie-Hellman keys to PEM

I'm trying to export Diffie-Hellman(modular version) keys to PEM format, using PointyCastle, since it offers ASN1 serialization/deserialization. This is my method for the conversion (for DhPublicKey): Uint8List toSpki() { ASN1Sequence outer =…
3
votes
1 answer

Diffie Hellman and AES on Android

I am trying to use Diffie Hellman for key exchange and AES to encrypt data with keys. Can anyone provide me a suitable work sample for android ?
Shardul
  • 27,760
  • 6
  • 37
  • 35
3
votes
1 answer

How to store Diffie HellMan Object's Keys in PEM Format using openSSL C++

I am facing one silly issue in storing my DH Keys in PEM Format. Here is working code snippet to generate Keys in Diffie Hellman format, I can store the DH Params in PEM Format. However I don't find any function in openSSL which can store the Keys…
Ekayaa
  • 169
  • 16
3
votes
1 answer

.NET Core 5.0 to Javascript DFH Key exchange not working

We are trying to get a browser based app using JS to exchange keys with a .Net Core 5.0 server using Eliptical Curve Diffie Hellman. Our app requires a shared secret on both ends for some specific processing we do (not encryption, but our own…
twreynol
  • 241
  • 1
  • 2
  • 12