Zeroise data in memory.
Public Declare Function WIPE_Data Lib "diCrPKI.dll"
(ByRef lpData As Byte, ByVal nBytes As Long) As Long
Alternative aliases for VBA/VB6 users to deal with Byte and String types explicitly:
Public Declare Function WIPE_Bytes Lib "diCrPKI.dll" Alias "WIPE_Data"
(ByRef lpData As Byte, ByVal nBytes As Long) As Long
Public Declare Function WIPE_String Lib "diCrPKI.dll" Alias "WIPE_Data"
(ByVal strData As String, ByVal nStrLen As Long) As Long
nRet = WIPE_Data(lpData(0), nBytes) ' Note the "(0)" after the byte array parameters
VBA/VB6 aliases only:
nRet = WIPE_Bytes(lpData(0), nBytes)
nRet = WIPE_String(strData, nStrLen)
long __stdcall WIPE_Data(void *lpData, long nDataLen);
If successful, the return value is zero; otherwise it returns a nonzero error code.
Public Function wipeBytes (ByRef lpToWipe() As Byte) As Byte()
Public Function wipeString (ByRef szToWipe As String) As String
Wipe.Data Method
Wipe.String Method
static bool dipki::Wipe::Data (bvec_t &data)
static bool dipki::Wipe::String (std::string &s)
static Wipe.data(data)
This function does not free any memory; it just zeroises it.
Dim lpData() As Byte
lpData = ... ' n bytes of data
nRet = WIPE_Data(lpData(0), n)
Dim strData As String
strData = "my deepest secrets"
nRet = WIPE_String(strData, Len(strData))
strData = ""
long pwdlen;
char password[256];
pwdlen = PWD_Prompt(password, sizeof(password)-1, "Test");
if (pwdlen >= 0)
printf("Password entered=[%s]\n", password);
else
printf("No password entered\n");
/* ... do something with password ... */
WIPE_Data(password, pwdlen);
Dim strData As String
strData = "my deepest secrets"
strData = wipeString(strData)
Dim lpData() As Byte
lpData = cnvBytesFromHexStr("DEADBEEF")
Debug.Print "BEFORE: " & cnvHexStrFromBytes(lpData)
Call wipeBytes(lpData)
Debug.Print "AFTER: '" & cnvHexStrFromBytes(lpData) & "'"