c++ - session key - MSDN - Microsoft

标签 c++ encryption msdn

我正在开发一个应用程序,该应用程序通过使用 CryptEncrypt() 加密文件并使用来自 documentation 的 session key 来保护文件 我不知道它在说什么 session 。那是不是别人把我的加密文件拿到另一台机器上(或者在同一台机器上但不同用户)即使他有密码也无法解密?

谁能帮我澄清一下他的观点。

提前感谢您的宝贵时间。

最佳答案

Is that means that if some one else takes my encrypted file to another machine (or on the same machine but different user) can not decrypted it even he has the password?

没有,

通过生成与密码匹配的哈希来生成用于加密和解密的 session key 是很常见的:

// Hash in the password data. 
if(!CryptHashData( m_hHash, (BYTE *) m_strPassphrase.c_str(), (DWORD) m_strPassphrase.length(), 0)) 
{
    //  ...
}

// Derive a session key from the hash object. 
if(!CryptDeriveKey( m_hCryptProv, ENCRYPT_ALGORITHM, m_hHash, KEYLENGTH, &m_hKey))
{ 
    //...
}

m_hKey 现在可用于加密/解密。

CryptEncrypt( m_hKey, NULL, bEOF, 0, m_pBlockBuffer, &dwCount, m_dwBufferLen)

或者..

CryptDecrypt( m_hKey, 0, bEOF, 0, m_pBlockBuffer, &dwCount)

关于c++ - session key - MSDN - Microsoft,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12747481/

相关文章:

c++ - 指针引用类型的序列

Java加密日志文件

windows - 您可以使用 MSDN 操作系统订阅在 Azure 上运行 Windows 客户端 VM 吗?

c++ - 列出所有正在运行的应用程序 MASM32 程序集

C++二进制输出问题

c++ - 在插入其他线程时有效地遍历 map

其他属性的 Maven 密码加密

encryption - 保护 Windows Azure 和 web.config 中的连接字符串

C++ - 64 位上 SP_DEVINFO_LIST_DETAIL_DATA_W 的大小

C++ MySQL 链接器错误