我正在开发一个应用程序,该应用程序通过使用 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/