Zeroises data in memory.
Public Declare Function WIPE_Data Lib "diCryptoSys.dll"
(ByRef lpData As Byte, ByVal nBytes As Long) As Long
Alternative aliases for Visual Basic users to deal with Byte and String types explicitly:
Public Declare Function WIPE_Bytes Lib "diCryptoSys.dll" Alias "WIPE_Data"
(ByRef lpData As Byte, ByVal nBytes As Long) As Long
Public Declare Function WIPE_String Lib "diCryptoSys.dll" Alias "WIPE_Data"
(ByVal strData As String, ByVal nStrLen As Long) As Long
nRet = WIPE_Data(abData(0), nBytes)
' Note the "(0)" after the byte array parameter
Visual Basic only:-
nRet = WIPE_Bytes(abData(0), nBytes)
nRet = WIPE_String(strData, nStrLen)
long __stdcall WIPE_Data(void *lpData, long nDataLen);
Byte
array to be cleared.If successful, the return value is zero; otherwise it returns an error code.
Wipe.Data Method
Wipe.String Method
static bool crsysapi::Wipe::Data (bvec_t &data)
static bool crsysapi::Wipe::String (std::string &s)
static Wipe.data(data)
This function does not free any memory; it just zeroises it.
Dim abData(3) As Byte Dim nLen As Long Dim nRet As Long ' Set up data in byte array abData(0) = &HDE abData(1) = &HAD abData(2) = &HBE abData(3) = &HEF Debug.Print "Before WIPE_Data: " & "[" & cnvHexStrFromBytes(abData) & "]" nLen = UBound(abData) - LBound(abData) + 1 nRet = WIPE_Data(abData(0), nLen) Debug.Print "After WIPE_Data: " & "[" & cnvHexStrFromBytes(abData) & "]"
or use alias in VB
nRet = WIPE_Bytes(abData(0), n)
Dim strData As String Dim nRet As Long strData = "my deepest secrets" Debug.Print "Before WIPE_String: " & "[" & strData & "]" nRet = WIPE_String(strData, Len(strData)) ' Set to empty as well... strData = "" Debug.Print "After WIPE_String: " & "[" & strData & "]"
In C:
char passwd[256]; printf("Enter password: "); /* Accept password from user * ... * ... then do something with it * ... * Wipe it */ WIPE_Data(passwd, strlen(passwd));