public static void main(String[] args) {
junit.textui.TestRunner.run(Crypt32Test.class);
}
public void testCryptProtectUnprotectData() {
DATA_BLOB pDataIn = new DATA_BLOB("hello world");
DATA_BLOB pDataEncrypted = new DATA_BLOB();
assertTrue(Crypt32.INSTANCE.CryptProtectData(pDataIn, "description",
null, null, null, 0, pDataEncrypted));
PointerByReference pDescription = new PointerByReference();
DATA_BLOB pDataDecrypted = new DATA_BLOB();
assertTrue(Crypt32.INSTANCE.CryptUnprotectData(pDataEncrypted, pDescription,
null, null, null, 0, pDataDecrypted));
assertEquals("description", pDescription.getValue().getString(0, true));
assertEquals("hello world", pDataDecrypted.pbData.getString(0));
Kernel32.INSTANCE.LocalFree(pDataEncrypted.pbData);