【发布时间】:2011-08-27 08:01:36
【问题描述】:
Microsoft Windows 2000 和更高版本公开了 Data Protection API (DPAPI),它为每个用户或每个系统的上下文加密数据。调用者不提供用于加密数据的密钥。而是使用从用户或系统凭据派生的密钥对数据进行加密。
此 API 通过 ProtectedData 类方便地在 .NET 中公开:
// Encrypts the data in a specified byte array and returns a byte array
// that contains the encrypted data.
public static byte[] Protect(
byte[] userData,
byte[] optionalEntropy,
DataProtectionScope scope
)
// Decrypts the data in a specified byte array and returns a byte array
// that contains the decrypted data.
public static byte[] Unprotect(
byte[] encryptedData,
byte[] optionalEntropy,
DataProtectionScope scope
)
Linux 上是否有等效的 API? 一个好处是它可以方便地与 Java 集成。
如果没有,我有什么选择?
【问题讨论】:
标签: java .net windows linux security