对Linux数据保护API等效数据、Linux、API

2023-09-03 02:30:39 作者:心上人

Microsoft Windows 2000和更高版本揭露数据保护API (DPAPI)用于加密数据的每用户或每个系统环境。调用者没有提供与对数据进行加密的密钥。而是,数据被加密与来自用户或系统凭证派生的密钥

Microsoft Windows 2000 and later versions expose the Data Protection API (DPAPI) that encrypts data for a per-user or per-system context. The caller does not provide a key with which to encrypt the data. Rather, the data is encrypted with a key derived from the user or system credentials.

该API方便地通过ProtectedData类:

This API is conveniently exposed in .NET via the ProtectedData class:

// 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方便集成。的

什么是我的选择,如果没有一个?

What are my alternatives if there isn't one?

推荐答案

它不看任何更多(或更少)比先进PGP或的 pretty的良好隐私。有可供PGP API和一个我记得别人讲好心的是充气城堡。

It doesn't look any more (or less) advanced than PGP, or Pretty Good Privacy. There are APIs available for PGP, and the one that I recall others speaking kindly of is Bouncy Castle.

下面是一个例子。

Here's an example of how someone used Bouncy Castle.

更好的API或解决方案可以用,这取决于您的特定需求。

Better APIs or solutions may be available, depending on your specific needs.

 
精彩推荐
图片推荐