diffie-hellman

I have P & G— how do I use the Wincrypt API to generate a Diffie-Hellman keypair?

天涯浪子 提交于 2019-12-11 15:09:49
问题 There's an MSDN article here, but I'm not getting very far: p = 139; g = 5; CRYPT_DATA_BLOB pblob; pblob.cbData = sizeof( ULONG ); pblob.pbData = ( LPBYTE ) &p; CRYPT_DATA_BLOB gblob; gblob.cbData = sizeof( ULONG ); gblob.pbData = ( LPBYTE ) &g; HCRYPTKEY hKey; if ( ::CryptGenKey( m_hCryptoProvider, CALG_DH_SF, CRYPT_PREGEN, &hKey ) ) { ::CryptSetKeyParam( hKey, KP_P, ( LPBYTE ) &pblob, 0 ); Fails here with NTE_BAD_DATA . I'm using MS_DEF_DSS_DH_PROV . What gives? 回答1: It may be that it just

Diffie Hellman key agreement using RSA keys?

五迷三道 提交于 2019-12-11 12:33:21
问题 I want to have 2 parties agree on the same secret key using their public and private keys. I do not want them to have any interaction. So I'm thinking method(A.privKey, B.pubKey) gives the same number as method(B.privKey, A.pubKey) I was wondering if the Diffie-Hellman key agreement algorithm works in Java when you use KeyPairGenerator.getInstance("RSA") If so, how can I do this? Or do I need to use the KeyPairGenerator.getInstance("DH") ? I have searched online and can't seem to find the

M2Crypto Diffie-Hellman parameters as .pem

半世苍凉 提交于 2019-12-11 03:35:26
问题 What is the M2Crypto equivalent of this openssl cli command? openssl dhparam -out dh.pem 2048 My attempt Looking through the test cases I can generate diffie-hellman parameters as such: >>> import M2Crypto.DH >>> params = M2Crypto.DH.gen_params(2048, 2, lambda: None) I cannot, however, generate a .pem representation of these params. There doesn't appear to be a method to do so on the DH object: >>> help(params) Help on instance of DH in module M2Crypto.DH: class DH | Object interface to the

Determining a Private Key (Diffie-Hellman)

ε祈祈猫儿з 提交于 2019-12-10 17:28:57
问题 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 key(variable) the recipients public key (constant). When looking at my private key - P and G are both within it. For example, the first 'x' bytes seem to have no relation to anything, then the next 'y' bytes are P , the next two bytes are static, and the next

What checks should I perform when I create a Diffie Hellman Key agreement keys from fixed p and g values using OpenSSL1.1.0g?

痞子三分冷 提交于 2019-12-10 11:34:48
问题 Hello I attempt to make a Diffie Hellman Keys using fixes p and g parameters via this piece of code base upon this answer: #include <openssl/dh.h> #include <openssl/bn.h> int generateKeys(DH *encryptionInfo) { int codes; BIGNUM *two = BN_new(), *p=NULL; puts("Select fixed p and g parameters\n"); if(two == NULL) { return -1; }; if(p=NULL){ BN_free(two); return -1; } BN_set_word(two,2); if( 1 != DH_set0_pqg (encryptionInfo, get_rfc3526_prime_2048(p), NULL, two)) return -1; // if(1 != DH

TLS 1.2 ECDHE_RSA signature

戏子无情 提交于 2019-12-09 07:33:17
问题 This question was migrated from Information Security Stack Exchange because it can be answered on Stack Overflow. Migrated 3 years ago . I'm currently working on a Java TLS server. I'm trying to get the following CipherSuite to work : TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA When I test it using openssl s_client I get the following error after the ServerKeyExchange message : 140735242416208:error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature type:t1_lib.c:1130: Here is the TLS

Java - Diffie-Hellman Encryption - Wrong Output

二次信任 提交于 2019-12-09 07:20:48
问题 I'm attempting to implement Diffie-Hellman key exchange. I am a little confused with how to use the secret key once generated. As seen in the output, the 2 secret keys are generated using the same prime & base as normal in the key exchange, and trade public keys when generating the secret keys, however they are not outputting the same value as I expected. I'm getting very confused with how to implement this encryption method and would be very grateful for some direction. My overall aim for

Need to create DHPublicKey from y, p, g as BigIntegers

你说的曾经没有我的故事 提交于 2019-12-08 04:18:04
问题 I need a DHPublicKey to encrypt some data. Therefore I have been provided with all the needed parameters as BigIntegers (y, p, g). Unfortunately I don't see a straight way for creating a public key object from these parameters that would fit the DHPublicKey interface. Any idea? 回答1: KeyFactory keyFactory; KeyPairGenerator kpg; DHPublicKey originalDhPubKey, fromSpecsDhPubKey; DHPublicKeySpec dhPubKeySpecs; KeyPair kp; BigInteger p, g, y; // generate a DH key pair kpg = KeyPairGenerator

OpenSSL used fixed Values for Diffie Hellman Key generation

爱⌒轻易说出口 提交于 2019-12-07 22:48:04
问题 According to that piece of documentation: https://wiki.openssl.org/index.php/Diffie_Hellman#Using_the_Low_Level_APIs Using the Low level API's for Diffie Hellman (need to perform a group Key agreement). For simplicity I need to provide fixed values for Diffie Hellman p and g values for now I use the function DH_generate_parameters_ex but any solution using these options may add a communication overhead and there are fixed values for p and g for Diffie Hellman offering good security. So using

Securing an android application

六月ゝ 毕业季﹏ 提交于 2019-12-07 13:32:57
问题 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 to the keystore is visible in plain text in the application source: keyStore.load(is, "passwd".toCharArray()); I am concerned that if someone was to reverse engineer the app, they would be able to impersonate another user and compromise the security