c-在Windows内核模式下的Openssl



有没有办法在windows内核模式下使用OpenSSL库?我想制作一个windows过滤器驱动程序,它可以拦截读写操作并加密和解密缓冲区。我已经制作了一个驱动程序,可以用一些任意内容替换缓冲区,但现在我需要加密原始内容。我试图在项目中包含OpenSSL dll-s,我可以编译和安装驱动程序,但当我尝试启动它时,我收到了这个错误出现系统错误2。系统找不到指定的文件

这是进行加密的代码。我知道使用静态密钥不安全,但它只是用于测试。

void encrypt_aes_ctr(unsigned char* key, unsigned char* iv, unsigned char* data, unsigned char* out_data,int in_len,int*out_len)
{
int  len;
EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();;
EVP_EncryptInit_ex(ctx, EVP_aes_256_ctr(), NULL, key, iv);
EVP_EncryptUpdate(ctx, out_data, out_len, data, in_len);
EVP_EncryptFinal_ex(ctx, out_data + *out_len, &len);
*out_len += len;
}

这是我在SwapPreWriteBuffers函数中进行的调用

unsigned char key[32] = { 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8 };
unsigned char iv[16] = { 1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4 };
int len;
encrypt_aes_ctr(key, iv, origBuf, newBuf, writeLen, &len);

您应该使用CNG API,这是加密的Microsoft标准API。

例如加密

以下是在内核(随机(中使用BCrypt的代码示例

最新更新