Ok so I have 5 files I am encrypting. I am not setting the IV.
The fist file decrypt's fine,
then the first block of the remaining files is not decrypted.
So the files decrypt 99%.
Ive tried setting the IV to a static value and a random value, same…
I'm trying to extract attributes from a certificate on Windows and have been using Wincrypt api's for that.
When I encouter the SUBJECT_ALT_NAME certificate extension (szOID_SUBJECT_ALT_NAME "2.5.29.7") with the "OTHER_NAME" option - I get…
I am trying to add certificate to store, but I am new in it. I've been searching for information about how to install certificate to store without finding certificate context from store (I have no certificate in store). Everything I found I've been…
I am trying to acquire a CNG private key handle to sign data per a certificate.
But I am struggling to get a valid key handle, in the first place.
The certificate lookup via fingerprint is working. I am recieving the context of a self signed…
I am trying to create creating a pfx file using PFXExportCertStoreEx API for a self-signed certificate and its corresponding private key.
Self-signed Certificate exporting to pfx but private key not exporting to a pfx file. I set the export policy…
So here is a question.
I have an old code on a Windows system that just takes a short string and makes CryptEncrypt on it with a public RSA key.
The minimum working example is here (avoiding any checks to make it shorter. avoiding freeing as…
I'm trying to check the revocation state of a X509 certificate in a c++ program with the use of wincrypt.h. Sadly I'm not able to find a comprehensive example. In c# the code would be the following:
X509Certificate2 certificate = new…
I am attempting to encrypt the buffer which I send trough Winsock. I don't know that much about encryption at all except the absolute basics and I went with Windows' WinCrypt library since it seems the most basic and easiest I can implement,…
I have question: when I'm trying to generate AES key 128 lenght with CryptGenKey I have data leak?
Code below:
void GeKey(HCRYPTKEY hKey, HCRYPTPROV hProvs)
{
DWORD len_iv = 0;
if (!CryptGenKey(hProvs, CALG_AES_128, CRYPT_EXPORTABLE,…
(Sorry for my bad English.) I have some problems in my code.so I will try to explain my problem. I have a simple exe file with signed(pkcs7). I want to verify this file (without an internet connection). I don't want to use WinVerifyTrust() because I…
I'm writting little program that will generate RSA key pair, export\import keys and encrypt string.
So, I have written this code:
void EncryptString(std::string data)
{
int lenght = strlen(data.c_str());
DWORD temp = data.length() *…
I'm making simple implementation RSA-2048. I found some code on another forum.
#include
#include
#include
#include
using namespace std;
#pragma comment (lib, "Crypt32.lib")
BYTE* Crypt(const string&…
The code below used to work. I think it broke after some .NET Framework or Windows 10 upgrade, but not sure.
It opens a temporary certificate store for generating self-signed certificates.
using System;
using…
I'm trying to encrypt a string as size of 8 bytes (64 bits) using AES128 from wincrypt.h, note that the string is smaller than the block size of AES which is 128 bits.
HCRYPTKEY hKey;
if (!CryptDeriveKey(hProv, CALG_AES_128, hHash, 0, &hKey)) {
…
I have this function which simply encrypts a string (this function works fine, and tested).
DWORD SomeObj::Encrypt(string * To_Enc) {
DWORD text_len = (To_Enc->length());
if (!CryptEncrypt(this->hKey,
NULL, // hHash = no hash
…