To create a string of, say, length 40 characters, do either:
Dim sData As String * 40
or
Dim sData As String sData = String(40, " ")
If you know the output string needs to be the same size as the input, do this:
Dim strInput As String Dim strOutput As String strInput = "......" strOutput = String(Len(strInput), " ")
To create a byte array of a given length:
Dim abData() As Byte Dim nLen As Long nLen = 40 ReDim abData(nLen - 1)
Note that byte arrays in VB are indexed from 0 to nLen - 1.
To create a byte array of the same length as an existing array, do this:
Dim abOutput() As Byte ReDim abOutput(Ubound(abInput))
To find the length of an existing byte array:
nLen = UBound(abData) - LBound(abData) + 1
Be careful, as this will cause a run-time error if abData() has not been ReDim'd.
Look at the code for the function cnvHexStrFromBytes in basCrPKI.bas
to see how this can be handled.
Integer types are never used in CryptoSys PKI.
Only Long types are used.
Compile error: ByRef argument type mismatch
it means you have omitted the "(0)" after a Byte parameter, e.g.
Dim abData() As Byte
' ...
nRet = WIPE_Data(abData, nBytes) ' WRONG: compile error
nRet = WIPE_Data(abData(0), nBytes) ' CORRECT