Microsoft Windows 2000和更高版本公開了爲每個用戶或每個系統上下文加密數據的Data Protection API(DPAPI)。調用者不提供用於加密數據的密鑰。相反,數據使用從用戶或系統證書導出的密鑰進行加密。Linux上Data Protection API的等效
該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集成。
如果沒有我的替代品,我的替代品是什麼?
PGP是否利用用戶或系統證書?我的理解是,對於PGP,您需要提供您自己的公鑰/私鑰對。 – 2011-05-17 15:16:48
DPAPI中的證書只是一個RSA公鑰/私鑰對,您認爲您屬於哪個關鍵(系統或用戶)是您自己的看法,而不是關鍵的功能。 – 2011-05-17 15:18:32
@EdwinBuck「由於DPAPI專注於爲用戶提供保護,並需要密碼才能提供此保護,它在邏輯上使用用戶的登錄密碼進行保護。」這裏的問題是你沒有訪問用戶登錄密碼,但該功能爲你提供了加密,密碼是關鍵。這讓你不用擔心其他用戶(甚至是root用戶)可以訪問你的數據(在Linux情況下,用戶當前沒有登錄的額外警告)。 – chacham15 2013-05-11 01:34:12