CryptoSys PKI Pro Manual

WIPE_Data

Zeroise data in memory.

VBA/VB6 Syntax

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)

C/C++ Syntax

long __stdcall WIPE_Data(void *lpData, long nDataLen);

Parameters

lpData
[in,out] array to be cleared.
nDataLen
[in] number of bytes in array to be cleared.

Returns (VBA/C)

If successful, the return value is zero; otherwise it returns a nonzero error code.

VBA Wrapper Syntax

Public Function wipeBytes (ByRef lpToWipe() As Byte) As Byte()
Public Function wipeString (ByRef szToWipe As String) As String

.NET Equivalent

Wipe.Data Method
Wipe.String Method

Python Equivalent

static Wipe.data(data)

C++ (STL) Equivalent

static bool dipki::Wipe::Data (bvec_t &data)
static bool dipki::Wipe::String (std::string &s)

Remarks

This function does not free any memory; it just zeroises it.

Example (VBA core function)

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);

Examples (VBA wrapper function)

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) & "'"

See Also

[Contents] [Index]

[PREV: TDEA_HexMode...]   [Contents]   [Index]   
   [NEXT: WIPE_File...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-06T00:43:03Z.