439
questions
0
votes
0
answers
11
views
Define DH parametes in python-mbedtls
I'm using python-mbedtls library - https://github.com/Synss/python-mbedtls/tree/master
my goal is to create handshake with different cipher suites,
I've managed to do so with the given server and ...
0
votes
0
answers
133
views
Error: "Invalid use of incomplete typeof 'DH' {aka 'struct dh_st'}" when using OpenSSL DH function in C
I'm Trying to implement a server-client application in C that uses OpenSSL's Diffie-Hellman key exchange for secure communication.However, during compliation, I'm encountering the following error: ...
0
votes
0
answers
56
views
How to recreate Bob and Alice Non-Interactive Diffie-Hellman Key-Exchange?
I'm trying to recreate the Bob and Alice Diffie-Hellman Key Exchange, since I'm doing my first steps in cryptography and cyber security.
The goal is to implement a non-interactive version of this ...
0
votes
1
answer
125
views
PACE PIN Generic Mapping implementation in c#
I'm trying to implement PACE PIN authentication with a generic mapping using elliptic curves. Here is the beginning of my method, I have a 6984 error here : • Send PKPCD,map and Receive PKPICC,map ...
-1
votes
1
answer
324
views
ECDH C# key exchange ( get the shared secret beetween the two party)
I have a smart card reader and a smart card. I need to perform a Diffie-Hellman key exchange between the chip and the reader to get the shared secret, and then generate a new DHMappedGenerator in C#.
...
0
votes
0
answers
75
views
Decrypting TLS_DHE_WITH_AES_256_CBC_SHA256
I am trying to delve into some cryptography and am trying to decrypt a base64 encoded encrypted string using js. The actual string has been encrypted using TLS_DHE_WITH_AES_256_CBC_SHA256 cipher.
I'm ...
0
votes
0
answers
55
views
Deriving DH shared secret
I'm quite new to cypto and I'm trying to derive DH shared secret between two parties. One part is in OP-TEE (a TA) and other part is a remote server. This is my public and private key values in the TA....
2
votes
1
answer
147
views
Load Public Key Byte as DH Key
I have a C code that generates a DH key pair as a raw byte. Then I send my public key to a python server using TCP/IP socket. My DH public key look like this:
derive_key_dh_public_value = {
0x46, ...
2
votes
1
answer
62
views
How do I create and connect anonymous-DH TLS sockets with Python and securely authenticate over them without possibility of credential forwarding?
I am writing a peer-to-peer protocol wherein nodes can connect to each other and the connection should be encrypted using TLS with session keys agreed with Diffie-Hellman exchange. However, using any ...
0
votes
0
answers
53
views
How do I get the common secret for numbers that are less than modulo in the modulo function?
I am trying to implement something similar to the Diffie-Hellman encryption algorithm on elliptic curves, my curve has parameters a = 0, b = 7, p = ...
0
votes
0
answers
166
views
Implementing Diffie-Hellman in python. Shared secret keys aren't getting matched
hope everything is well. I am trying to implement the Diffie_Hellman in Python. I read that for better security, it is recommended that the prime 𝑝
should be at least 2048 bits long, and 𝑔 should ...
0
votes
0
answers
73
views
Websites using DHE Diffie-Hellman key exchange
I have created a program that test various security measurements on mailservers. I want to test this but I need to find websites that use DHE.
Can anyone help me find a website for me to test on?
...
0
votes
0
answers
110
views
How migrate key reading DH-Pem in Delphi-Indy-SSL to C# on .NET 6.0?
dhparam.par
-----BEGIN DH PARAMETERS-----
...==
-----END DH PARAMETERS-----
Indy OpenSSL:
object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL
Destination = 'smtp.server:587'
Host = '...
1
vote
0
answers
143
views
Issue with implementing X25519 from RFC 7748
https://www.rfc-editor.org/rfc/rfc7748 gives a simple implementation of scalar multiplication on curve25519. They have some Python code and some pseudocode, and I tried my best to connect all of it ...
0
votes
0
answers
35
views
Trying to guess p and q from N by using Diffie-Hellman cycles algorithm, too slow BigInteger.Pow approach
Well,
I implemented a program to find p and q given N.
For p = 11 and q = 7, with a generator of g=2 or g=8 it seems to work pretty well,
But when I use a list of prime numbers given on the internet, ...
2
votes
0
answers
43
views
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 ...
-1
votes
1
answer
267
views
Oakley group 2 prime number contains pi, an irrational number
The function for Oakley group 2, p = 2^1024 - 2^960 - 1 + 2^64 * ⌊2^894 * π + 129093⌋, produces a prime number. It contains pi, an irrational number. How can an equation containing an irrational ...
1
vote
1
answer
383
views
Diffie-Hellman routines::modulus too small
Consider the following code:
const crypto = require("crypto");
function checksum(str, algorithm, encoding) {
return crypto
.createHash(algorithm || 'md5')
.update(str, 'utf8')
....
-2
votes
1
answer
696
views
Unable to Decrypt in Python using X25519 Keys for Cipher encrypted in Java
I am trying to implement cipher text decryption on cipher generated using key derivation on X25519 algorithm. While I am able to decrypt using private key generated in my system on Java, it fails on ...
1
vote
1
answer
118
views
Libsodium - use crypto_box_easy where receiver and sender are the same
I would like to use libsodium to encrypt little messages/secrets and share them among different users. The API is straightforward in case the receiver and sender are different. But what happens, when ...
0
votes
1
answer
389
views
Diffie-Hellman: How To Load the Generator and Prime values from .pem file in .Net
I generated a .pem file that contains Diffie-Hellman parameters. I used this command line:
openssl dhparam -outform PEM 2048 -out dhparam.pem
The file looks like this:
-----BEGIN DH PARAMETERS-----
...
0
votes
0
answers
42
views
How do I properly use the modulus operator in JAVA when it comes to very large numbers?
I am trying to get back the proper exponent, and while the example numbers (exampleA, exampleB, exampleP) all return what they should when running through the loop, plugging in long number(A, B, p) do ...
3
votes
1
answer
1k
views
Javascript Web Crypto - Unable to import ECDH P-256 Public Key
I'm trying to exchange public keys between Browser and Server, and generate secret to be used for encryption of data. I'm trying to utilize ECDH (Elliptic Curve Diffie-Hellman).
On the Server side I'm ...
1
vote
1
answer
882
views
ECDH key agreement generated Key Pair is always invalid in Android 12
I've written the below code following the official guide for ECDH Key Agreement on Android.
private static final String EC_SPEC = "p-256";
private static final String KEY_PAIR_NAME = "...
0
votes
1
answer
915
views
Key is not a valid public or private key
I am trying to import key pair created by RSACryptoServiceProvider into ECDiffieHellmanOpenSsl:
RSACryptoServiceProvider keyPair = EncryptionTools.GenerateRSAKeyPair(4096);
ECDiffieHellmanOpenSsl ...
1
vote
1
answer
580
views
For Diffie-Hellman keys, using d2i_PublicKey
I am trying to pull in a Diffie-Hellman 2048-bit public key in DER format and convert it into an internal EVP_PKEY value using d2i_PublicKey. I can do this with the corresponding private key and ...
0
votes
0
answers
77
views
iOS Does ATS not support RSA key exchange for PFS?
I recently set my info.plist about App Transport Security.
To prevent HTTP and allow HTTPS only, I turn off "Arbitrary allows Loads".
And I found certain site that I need to open by ...
1
vote
1
answer
1k
views
openssl_dh_compute_key(): Argument #2 ($private_key) must be of type OpenSSLAsymmetricKey
I am trying to decrypt a response Tokens which where encrypted using a Diffie-Hellman (type curve25519) via AES-GCM and additional authenticated data (AAD). I am new to PHP so I am not sure how can ...
1
vote
2
answers
669
views
Java X25519 shared secret is not correct when using testing vectors from RFC7748
When using RFC7748 test vectors for elliptic curve diffie hellman in java, I cannot get expected shared secret key. I am able to do so in other languages. I am using openjdk 11 with default Sun ...
0
votes
0
answers
689
views
Use diffie hellman key exchange algorithm to encrypt and decrypt files in python
I want to implement an algorithm which will encrypt and decrypt files using diffie hellman algorithm but I am unable to find any solution for the same. Here is my diffie hellman code:
import pyDH
d1 = ...
1
vote
0
answers
624
views
Compute Diffie-Hellman key pair and shared secret in iOS with Swift
I need on iOS with Swift to:
Generate a Diffie–Hellman key pair with a pre-agreed modulus P and a base G
Compute a shared secret with a local private key, a remote public key and pre-agreed modulus P
...
-2
votes
1
answer
81
views
I'm trying to recreate the Diffie-Hellman Key Exchange using addition but i get errors
#include<stdio.h>
#include<math.h>
long long int add(long long int a, long long int b,
long long int G)
{
if (b == 1)
return a;
else
return (((long long ...
-1
votes
1
answer
128
views
Calculating Diffie Hellman Challenge - Python vs NodeJS
I'm trying to calculate the Diffie-Hellman Challenge in Python based on the algorithm from a NodeJS client app. The code for the NodeJS client app is as follows:
var a = crypto.randomBytes(25)....
6
votes
1
answer
4k
views
OpenSSL 3 Diffie-Hellman Key Exchange C++
Before OpenSSL3 this was simple.
DH* dh = DH_new();
/* Parameters */
dh->p = BN_bin2bn(bin_p, bin_p_size, NULL);
dh->g = BN_bin2bn(bin_g, bin_g_size, NULL);
/* Private key generation */
...
1
vote
1
answer
782
views
How to do a triple Diffie-Hellman(3 - DH) key agreement in Java using bouncy castle?
There are ample examples on how to do Diffie-Hellman key agreement to compute a shared secret. However, I could not find any example on how to do 3DH in java using bouncy castle(or any security ...
1
vote
1
answer
4k
views
End To End Encrypted Chat Application using Windows Forms and . Net C#. Where do I start with encryption? [closed]
I have an assignment at school to create a chat application. I have created this using SignalR to ensure real time communication. However, our teacher wanted also end to end encryption.
I have 2 ...
0
votes
2
answers
2k
views
Can I access the private key of solana account (via phantom) to encrypt data?
As far as I know, every account is represented by a public/private key. The public key can be accessed anytime and the private key is (obviously) never shown.
Is there however a way to access the ...
0
votes
1
answer
726
views
Finding generator g for a 20-digit prime integer I'm Elgamal
I was curious to learn if there is a simple method/algorithm through which I can obtain a generator g for a 20-digit prime integer to implement in Elgamal cryptosystem.
0
votes
0
answers
201
views
Diffie-Hellman algorithm between java and Node.js
I'm trying to simulate java Diffie Hellman codes in Node.JS
in java code I have 'key' and 'prime'
but I'm don't know how to use this values in Node.js code
Java :
private static byte[] ...
0
votes
0
answers
90
views
Are Diffie-Hellman and ECC public key / asymmetric cryptographies?
I have a doubt.
In RSA we generate a public key (e,n) and a private key (d,n). and the these keypairs are actually used to encrypt (by public-key) and decrypt (by private-key) the actual data during ...
2
votes
1
answer
202
views
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 ...
0
votes
0
answers
2k
views
OpenSSL diffie-hellman secret key exchange with openssl
When I follow https://sandilands.info/sgordon/doc/diffie-hellman-secret-key-exchange-with-openssl steps I face below ERROR.
Can anyone help me ? Looks keys are not matching.
I edited questions and ...
0
votes
0
answers
1k
views
WHY do we use AQAB (2^16+1) as public exponent in RSA?
So I have been learning RSA and really trying to understand it from a math perspective. I think I have a pretty good handle on it now except for one thing.
In all the explanations and tutorials I have ...
1
vote
0
answers
97
views
Common secret using ConcatKDH in node-jose
I'm trying to generate a common secret key using ConcatKDF algorithm.
In the following example alice is trying to generate a common secret using bobs public key using node-jose library:
const ...
0
votes
1
answer
406
views
How to implement DH keyagreement referring these Java codes?
I have written X25519 DH keyagreement with Java, but I have to use nodejs to reimplement this, so that I can make keyagreement between js client and java backend.
I used node crypto module, but the ...
1
vote
1
answer
433
views
Diffie Hellman Key Agreement using optional subprime q with DHParameterSpec in Java
I am trying to perform a Diffie Hellman Hey agreement, and as part of the parameter definition, I have 3 values:
a prime modulus p
a base generator g
a subprime q
looking at the various constructors ...
0
votes
0
answers
1k
views
Implementation of Pohlig-Hellman unable to solve for large exponents
I'm trying to create an implementation of the Pohlig-Hellman algorithm in order to create a utility to craft / exploit backdoors in implementations of the Diffie-Hellman protocol. This project is ...
1
vote
1
answer
405
views
In C#, how do I store large prime number?
Good day everyone,
I am attempting to implement the Diffie-Hellman key exchange protocol in C#.
Before anything, this is a test project. I am aware that I should NOT use it for any real application. I ...
0
votes
0
answers
73
views
Random integer secret generated for DH in TLS?
From my understanding, the client and the server would generate two random secrets that they would use to computer the shared key in DH for TLS. But how is this done? What algorithm does it use?
1
vote
0
answers
255
views
Why does the crypto module not have 'secp256k' curve when I try to use it in electronJs?
I get this error when I try to use secp256k1 (default crypto module) in electronJs. I do not get this error when I am not using electron.
I also logged all of the available curves. There's no ...