Questions tagged [wincrypt]

The portion of Windows API dealing with cryptography.

The portion of Windows API dealing with cryptography.

85 questions
1
vote
0 answers

STATUS_INVALID_PARAMETER error import diffie hellman public key using BCryptImportKeyPair

I am trying to add a public key into diffie Hellman implementation of Bcrypt. example suggested to create and export a public key. In my case I already got the public key from the client. I am trying to use that public key to generate shared…
Prakash N
  • 1,020
  • 1
  • 8
  • 20
1
vote
2 answers

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

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…
vengy
  • 1,548
  • 10
  • 18
1
vote
1 answer

How to get next certificate in chain

I want to get parent certificate (or all certificates in chain for that matter) from Windows Certificate Store (assuming I know the location of the end certificate). I need to get each one in order to build my own custom X509_STORE (using OpenSSL).…
Leśny Rumcajs
  • 2,259
  • 2
  • 17
  • 33
1
vote
0 answers

CryptEncrypt returns ERROR_MORE_DATA

I am trying to use wincrypt api to implement AES encryption/decryption. I've written this code, but it doesn't work. CryptEncrypt returns FALSE and GetLastError() == ERROR_MORE_DATA. typedef struct { BLOBHEADER hdr; DWORD key_size; …
i480612
  • 11
  • 3
1
vote
0 answers

Encrypt text with AES with phpseclib, Decrypt text with C++ Windows Crypto API

Hello there so I am having a very weird issue while trying to decrypt AES text that has been encrypted with AES using phpseclib. I RSA encrypt an AES key that I use to encrypt a message to the server. the server decrypt's the RSA encrypted AES key…
swayz
  • 65
  • 7
1
vote
1 answer

undefined reference to `_imp__CryptUnprotectData@28' with Crypt32.Lib && wincrypt.h included

I have a problem with my one of my projects. I use QtCreator with MinGW and Qt 5.4.0 When I try to compile, this simple line gets me some errors : CryptUnprotectData(data.password, NULL, NULL, NULL, NULL, (DWORD) 0, data.uncryptedPassword); ( with…
Olbaid
  • 17
  • 6
1
vote
0 answers

Wrong encryption results for AES128/ECB (OpenSSL and WinCrypt)

I'm trying to encrypt text block with AES128 (ECB mode), to test resulted encryption/decryption functionality I'm using using ECB-AES123 test vectors from "Recommendation for Block Cipher Modes of Operation: Methods and Techniques, NIST Special…
1
vote
1 answer

md5 for an exe does not give the expected digest

I am new here, I hope I am doing this right. I made a c++ application that computes MD5 hash digest for files following microsoft implementation in this link http://msdn.microsoft.com/en-us/library/windows/desktop/aa382380%28v=vs.85%29.aspx the case…
user4464366
  • 63
  • 1
  • 1
  • 4
0
votes
1 answer

Using Windows cryptapi with AES128 Static Key and IV

I'm having trouble using the Windows cryptography API to encode/decode AES-128 blocks. It seems like the system is geared around first generating a hash, then using that hash to set the key, i.e. CryptCreateHash, CryptHashData, CryptDeriveKey. But…
Charles Lohr
  • 695
  • 1
  • 8
  • 23
0
votes
0 answers

How to protect WinUI 3 app private key from another apps unauthorized access?

I'm developing a WinUI 3 app for Windows 11 in c#. My app save encrypted data into a local database (data are encrypted by RSACryptoServiceProvider class). The RSACryptoServiceProvider save the private and public keys into a container that other…
jhon tonini
  • 67
  • 3
  • 7
0
votes
0 answers

Decrypting AES-Encrypted data in Java using the Wincrypt API in C++

I am trying to decrypt data encrypted with AES in Java, using the Wincrypt API in C++. On the C++ side, I get the error code 80090005 at the CryptDecrypt stage. What exactly is the C++ Wincrypt API default algorithm? Is my algorithm selection…
Content
  • 53
  • 8
0
votes
0 answers

C++ Windows CryptDecrypt always return successful

Im having the code below but no matter what i pass as key the CryptDecrypt always return 1/TRUE, I have problem checking if the provided key is correct or not. void DecryptAES(char* content, DWORD contentlen, char* key, DWORD keyLen) { …
Alex
  • 49
  • 6
0
votes
0 answers

openssl VS wincrypt produce different result

I have used the same plain text, same public key, but get different result in Wincrypt and openssl. My enviroment is win7 64bit and VS 2010 and openssl 1.1.1S. here is the code: /* * An example of using PEM encoded RSA private keys with CAPI * -…
Mike
  • 185
  • 6
0
votes
0 answers

Windows build a full encrypted message from outside signing

I can encrypt a message in windows given a certificate with a private key with CryptMsgOpenToEncode and CryptMsgUpdate. This returns an ASN1 signature which contains the signature and the certificate enclosed in a full ASN1 message. My problem now…
Michael Chourdakis
  • 10,345
  • 3
  • 42
  • 78
0
votes
1 answer

C++ CNG NCrypt: Can't open persisted key from Key Storage Provider

I have two programms. One creates a persisted key and saves it to key storage provider, then signs the hash and write the sign to the regedit. Second program opens the key from provider and verifies the sign gotten from the regedit. But my problem…
Alexandr
  • 9
  • 2