怎么用CryptGetUserKey获得会话密钥

sdxzw 2013-08-06 09:31:02
怎么用CryptGetUserKey获得密钥容器里的会话密钥?


MSDN的描述:
Additionally, some providers allow access to other user-specific keys through this function. For details, see the documentation on the specific provider.

不知道WIN7上那个CSP提供了这个功能?非WINDOWS自带的CSP就不需要了。

怎么让导入到密钥容器里的会话密钥永久保存在密钥容器里?
CryptDestroyKey是这样描述的:
If the handle refers to a session key, or to a public key that has been imported into the cryptographic service provider (CSP) through CryptImportKey, this function destroys the key and frees the memory that the key used. Many CSPs overwrite the memory where the key was held before freeing it. However, the underlying public/private key pair is not destroyed by this function. Only the handle is destroyed.
...全文
259 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
郎兮 2014-12-10
  • 打赏
  • 举报
回复
会话密钥是临时生成的 不是永久的 会话结束后会话密钥就销毁了 可以用接收方公钥导出加密后的会话密钥。
sdxzw 2013-12-06
  • 打赏
  • 举报
回复
会话密钥(签名密钥和交换密钥之外的密钥)的句柄我没找到获取的方法,似乎CSP也不保存会话密钥
sdxzw 2013-12-06
  • 打赏
  • 举报
回复
我知道的只能获取签名密钥和交换密钥的句柄,当然可能只有公钥或者私钥。只有公钥的时候,解密会失败;只有私钥的时候加密会失败,因为windows不允许私钥加密公钥解密,至少我不知道这样做的方法
郎兮 2013-11-05
  • 打赏
  • 举报
回复
CryptGetUserKey()获取到的交换密钥句柄 这个句柄做加密可以 但是做解密出错为什么 80090020 内部错误 shit
sdxzw 2013-10-22
  • 打赏
  • 举报
回复
给个回复啊?好难看啊

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧