对Linux数据保护API等效 [英] Equivalent of Data Protection API on Linux

查看:179
本文介绍了对Linux数据保护API等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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方便地通过<一暴露在.NET href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.protecteddata.aspx">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.

下面是一个 href="http://wiki.service-now.com/index.php?title=Sample_Java_BouncyCastle_Algorithm_for_Encryption" rel="nofollow">例子。

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

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

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

这篇关于对Linux数据保护API等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆