sx_Encrypt

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_Encrypt

VB Declaration

Declare Function sx_Encrypt Lib "Apollo9.dll"

(ByVal cpBuffer As String,

ByVal cpPassword As String,

ByVal iLen As Integer)

As String

C Declaration

LONG FAR PASCAL sx_Encrypt

(BYTEP cpBuffer,  

BYTEP cpPassword,  

SHORT iLen);

Description

Encrypt a buffer with a password.

Parameters

cpBuffer : The buffer to encrypt.

cpPassword: The password used to encrypt the buffer. If no password is used the global workarea password is used.

iLen: The length of the string being encrypted.

Return Value

The buffer contents are returned encrypted as a string type.

VB Example

' Store a field encrypted

Sub ReplaceEncrypted( cpValue$, cpField$, cpPassword$ )

Dim sTemp As String

Dim sEncrypted As String

 

' Copy cpValue into sTemp so encryption does not destroy the  

' contents of cpValue.

sTemp = cpValue

sEncrypted = sx_Encrypt( ByVal sTemp, cpPassword, Len( sTemp ))

sx_Replace cpField, R_CHAR, ByVal sEncrypted

End Sub

C Example

//Store a field encrypted

void ReplaceEncrypted(BYTEP cpValue, BYTEP cpField, BYTEP cpPassword)

{

char sTemp[255];

//Copy cpValue into sTemp so encryption does not destroy the

//contents of cpValue.

strcpy( sTemp, cpValue );

sx_Replace( cpField, R_CHAR, sx_Encrypt( sTemp, cpPassword,

lstrlen(sTemp)) );

return;

}

See Also

sx_Decrypt, sx_DbfEncrypt