How secure is ProtectedData.Protect (DPAPI)?

后端 未结 3 2065
执笔经年
执笔经年 2020-12-15 19:45

Suppose someone gets access all of my hard disk, I guess the weak spot would be my windows password. Without knowing/being able to retrieve that, the data should be pretty m

相关标签:
3条回答
  • 2020-12-15 20:18

    See this article on DPAPI Security. Basically, it is as secure as your Windows password -- if your password is reset by an administrator, the decryption key will be lost. The major attack vectors you'll need to look at are:

    • Password disclosure: "shoulder surfing", sticky notes, etc.
    • Capture of the computer's accounts database and the use of a password cracker
    • Online attack by "drive-by download", removable media AutoPlay, etc.
    • Capture of a password reset disk, if you've made one
    • Physical installation of a key-logging device or other "bug"
    0 讨论(0)
  • 2020-12-15 20:22

    EFS uses DPAPI, not the other way around. And Administrator can't read your key just like that.

    Before forgetting about DPAPI, I would consider the alternatives. If you encrypt the file yourself,

    1. You must select a strong algorithm and implement it well.
    2. You will need a key. Where will it be ?
    3. You will store the key in a file somewhere on your drive.
    4. That key is sensitive, obviously, you will want to encrypt it
    5. Goto 1

    DPAPI does 1 to 3 well. 4 and 5 are moot. If a Windows password is not enough to protect data, ask yourself why it is enough to CRUD that data in the first place.

    For better security, you can consider not saving the data but a (salted) hash of it, if possible. It makes your data write only, though. For example, if you want to verify a customer license number :

    • Save a salted hash value of it
    • Run the same hash on the salted license number you want to verify,
    • Compare the two. It they match, the license is valid.

    If you must read back encrypted data and a locally encrypted key is not enough, consider encrypting your application key (step 2 above) with a private key stored on a smart card.

    Either way, remember that things happens. You always need a backup key somewhere.

    0 讨论(0)
  • 2020-12-15 20:31

    DPAPI can be used both with and without optional entropy. There are only two ways DPAPI blobs without optional entropy can be compromised:

    1. A domain admin can directly retrieve anyone's history of DPAPI master keys at any time. Nothing else is required. These can be used to decrypt all blobs. Local administrators cannot do this.

    2. The user's Windows credentials are compromised.

    If you use optional entropy then the data cannot be decrypted by anyone who doesnt know the value. The entropy may be derived from a password required to launch the application etc. Without the value, the data is lost forever.

    EFS works differently. The user's key is protected using DPAPI for his profile, but the decryption key for the file itself is additionally directly encrypted with the administrator's public key as well. Therefore a domain admin can access the files.

    0 讨论(0)
提交回复
热议问题