wincrypt

I get 0x80070057 error code on certcreatecertificatechainengine func

感情迁移 提交于 2020-01-03 21:02:20
问题 I use visual studio 2013 and windows 7 32bit. I want to verify digital signature by root and chain of certificate. So I get 0x80070057 error code in certcreatecertificatechainengine(). bool result = false; HCERTCHAINENGINE hChainEngine; CERT_CHAIN_ENGINE_CONFIG ChainConfig; PCCERT_CHAIN_CONTEXT pChainContext; //PCCERT_CHAIN_CONTEXT pDupContext; HCERTSTORE hCertStore; //PCCERT_CONTEXT pCertContext = NULL; CERT_ENHKEY_USAGE EnhkeyUsage; CERT_USAGE_MATCH CertUsage; CERT_CHAIN_PARA ChainPara;

How to use diffie Hellman Sessionkey as password for AES Encryption

China☆狼群 提交于 2019-12-25 17:36:18
问题 I need to create a server and client in c++ which exchange Diffie Hellman public key and encryption with AES_256 so far I am using MSDN sample for DH public key Generatinghttps://docs.microsoft.com/en-us/windows/win32/seccrypto/diffie-hellman-keys and its fine with RC4 in both side (client and server) but after Converting sample to AES_256 I get error 0x80090005(NET_BAD_DATA) on client-side EncryptDecrypt API.strange part is if both client and server runs on the same machine (not the same OS)

What is the key agreement (or key derivation) function used by openssl?

只谈情不闲聊 提交于 2019-12-13 09:48:41
问题 I am trying to replace a openssl code to CNG winapi code. Below is the barebone openssl code which i have. const char *generator = ""; // 256 character hex string const char *prime = ""; // 256 character hex string dh = DH_new(); // Initialize dh's generator and prime BN_hex2bn(&(dh->g), generator); BN_hex2bn(&(dh->p), prime); // Generate public and private keys DH_generate_key(dh); // Extract server's public key from init_msg's 'key' BIGNUM *server_pub_key = BN_new(); BN_hex2bn(&server_pub

CryptAcquireContext fails in Windows 10 Creators Update

柔情痞子 提交于 2019-12-11 16:58:22
问题 I have a code that encrypts a file using AES CFB mode. While the code runs correctly in Windows 7, Windows 8 and previous versions of Windows 10, on Windows 10 Creators Update this line fails: if (!CryptAcquireContext(&hProv, NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES, 0)) { std::cout << "CryptAcquireContext Error\n"; return 1; } What could be the reason for it? P.S I saw that it is deprecated on MSDN, but I thought that function was so common. 来源: https://stackoverflow.com/questions/48622293

CTR-AES256 Encrypt does not match OpenSSL -aes-256-ctr

时光怂恿深爱的人放手 提交于 2019-12-11 05:03:55
问题 My problem is that I cannot get the AES 256 CTR output from the C code below to match the output from the OpenSSL command below. The C code produces this: 5f b7 18 d1 28 62 7f 50 35 ba e9 67 a7 17 ab 22 f9 e4 09 ce 23 26 7b 93 82 02 d3 87 eb 01 26 ac 96 2c 01 8c c8 af f3 de a4 18 7f 29 46 00 2e 00 The OpenSSL command line produces this: 5f b7 18 d1 28 62 7f 50 35 ba e9 67 a7 17 ab 22 3c 01 11 bd 39 14 74 76 31 57 a6 53 f9 00 09 b4 6f a9 49 bc 6d 00 77 24 2d ef b9 c4 Notice the first 16 bytes