net.sourceforge.jdpapi
Class DataProtector

java.lang.Object
  extended by net.sourceforge.jdpapi.DataProtector

public class DataProtector
extends java.lang.Object

An interface to the Microsoft Data Protection API (DPAPI).

See MSDN for more information

Author:
Kevin Conaway

Constructor Summary
DataProtector()
          Initializes the protector with no additional entropy and localMachine set to false
DataProtector(boolean localMachine)
           
DataProtector(byte[] entropy)
           
DataProtector(byte[] entropy, boolean localMachine)
           
 
Method Summary
 byte[] protect(java.lang.String input)
          Protect input using the Microsoft DPAPI CryptProtectData function.
 java.lang.String unprotect(byte[] input)
          Unprotect input using the Microsoft DPAPI CryptUnprotectData function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataProtector

public DataProtector(byte[] entropy,
                     boolean localMachine)
Parameters:
entropy - Additional entropy to include when encrypting (optional)
localMachine - If true, allow all users on the machine to decrypt a given ciphertext

DataProtector

public DataProtector(byte[] entropy)
Parameters:
entropy -
See Also:
DataProtector(byte[], boolean)

DataProtector

public DataProtector(boolean localMachine)
Parameters:
localMachine -
See Also:
DataProtector(byte[], boolean)

DataProtector

public DataProtector()
Initializes the protector with no additional entropy and localMachine set to false

See Also:
DataProtector(byte[], boolean)
Method Detail

protect

public byte[] protect(java.lang.String input)

Protect input using the Microsoft DPAPI CryptProtectData function.

See the CryptProtectData documentation for more details

Parameters:
input - Plaintext to encrypt
Returns:
ciphertext

unprotect

public java.lang.String unprotect(byte[] input)

Unprotect input using the Microsoft DPAPI CryptUnprotectData function.

See the CryptUnprotectData documentation for more details

Parameters:
input - Ciphertext
Returns:
Plaintext


Copyright © 2007. All Rights Reserved.