CryptImportKey Windows 8.1 Using AES_256 PLAINTEXTKEYBLOB
CryptImportKey Windows 8.1 Using AES_256 PLAINTEXTKEYBLOB
context->last_error = NULL;
const BYTE key[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// BLOBHEADER
0x00, 0x00, 0x00, 0x00,// Key size
0x23, 0x31, 0xb1, 0x24, 0x7b, 0x15, 0xdf, 0xb0,// AES KEY
0xc9, 0x92, 0xaa, 0xc4, 0x2e, 0x02, 0x9b, 0x07,
0xdf, 0x21, 0x12, 0x53, 0xba, 0x28, 0x77, 0xd2,
0x99, 0x74, 0x96, 0xa4, 0x54, 0x54, 0x0d, 0xf1 };
BLOBHEADER* hdr = (BLOBHEADER*)key;
hdr->aiKeyAlg = CALG_AES_256;
hdr->bType = PLAINTEXTKEYBLOB;
hdr->bVersion = CUR_BLOB_VERSION;//default value
hdr->reserved = NULL;//reserved, default value
LPDWORD key_size = (LPDWORD)&key[sizeof(BLOBHEADER)];
//*(DWORD *)(key + 0x14) = 0;
*key_size = AES_KEY_SIZE_;
if (!CryptImportKey(context->context, key, 32, 0, CRYPT_EXPORTABLE, &context->aes_hKey))
{
return context->last_error = GetLastError();
}
return context->last_error;
适用于 Windows 7,这不是导出的密钥,但在 Windows 8.1 上失败
如果有人找到了解决方案,这将有助于整个互联网。
用于 CryptImportKey 的 dwDataLen 参数设置为 32,应该是字节数组的总大小。
问题是这适用于窗口 7 :\
对不起,伙计们
相关文章:
- AES加密到解密未正确输出
- LINK 尝试使用 OpenSSL evp aes 256 c++ 时出错
- OpenSSL API,使用GCM(伽罗瓦计数器模式)进行AES加密
- 压缩天然气.AES.错误解密(可能加密)的文件
- 用于 AES-gcm 加密的 IV 中是否有不起作用的值?
- OpenSSL AES加密似乎无法正常工作
- AES ECB已知文本攻击
- AES-128 CFB-8解密的前16个字节已损坏
- C++中AES NI加密的正确方法
- aes cbc反向加密
- 在Crypto++中向AES解密传递密钥
- 如何使用 AES 和 sha256 哈希作为密钥加密++进行加密
- 无法为 AES 加密创建 contex.视窗XP
- 短消息 AES 性能C++
- QT:AES-256-CBC 根据 PHP 代码在C++中加密/解密
- 在加密++中使用RSA加密对称AES密钥
- 错误:AES 加密密钥:从"char*"到"无符号字符"的转换无效
- AES加密/解密接收所有明文
- 我在 c++ 中的 AES 代码有问题。明文正在更改,但加密邮件是相同的。我找不到我的错误
- 如何在文件中读取和写入 AES 密钥?