sx_Decrypt

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_Decrypt

VB Declaration

Declare Function sx_Decrypt Lib "Apollo9.dll"

(ByVal cpBuffer As String,

ByVal cpPassword As String,

ByVal iLen As Integer)

As String

C Declaration

LONG FAR PASCAL sx_Decrypt

(cpBuffer, cpPassword, lstrlen(cpBuffer)) );

Description

Decrypt a buffer previously encrypted with sx_Encrypt.

Parameters

cpBuffer : The buffer to decrypt.

cpPassword: The password used to decrypt the buffer. If no password is used (NULL) the global workarea password is used.

iLen: The length of the string being decrypted.

Return Value

The buffer contents are returned decrypted as a Visual Basic string.

VB Example

' Decrypt the value in a field

Function DecryptField(cField$, cPassWord$) as string

Dim cBuffer As String

cBuffer = sx_getTrimString("lastname")

sx_Decrypt( ByVal cBuffer, cPassword, Len( cBuffer ))

DecryptField = cBuffer

End Function

C Example

// Retrieve an encrypted field.

BYTEP RetrieveEncrypted( BYTEP cpBuffer, BYTEP cpField, BYTEP cpPassword )

{

strcpy(cpBuffer, sx_GetString(cpField));

return( sx_Decrypt(cpBuffer, cpPassword, lstrlen(cpBuffer)) );

}

See Also

sx_Encrypt, sx_DbfDecrypt