SET SAFETY OFF lcstartfile = "myfile.txt" IF FILE(lcstartfile) DELETE FILE (lcstartfile) ENDIF lcstartstring = REPLICATE("1234567890-=\~!@#$%^&*()_+|abcdefghijklmnopqrstuvwxyz,./<>?[]{}"+CHR(13),2000) STRTOFILE(lcstartstring,"myfile.txt") loCrypt = NEWOBJECT("_CryptApi",HOME()+"FFC\_Crypt.vcx") IF FILE(lcstartfile) MODIFY COMMAND (lcstartfile) IF MESSAGEBOX('Encrypt File?',1+32+4096,'Encrypt') = 1 =TestCrypt(.F.,lcstartfile) MODIFY COMMAND (lcstartfile) ENDIF IF MESSAGEBOX('Decrypt File?',1+32+4096,'Decrypt') = 1 =TestCrypt(.T.,lcstartfile) MODIFY COMMAND (lcstartfile) ENDIF ENDIF IF FILE(lcstartfile) DELETE FILE (lcstartfile) ENDIF RETURN FUNCTION TestCrypt LPARAMETERS plReverse, pcfile IF TYPE('pcfile') <> "C" .OR. !FILE(pcfile) RETURN .F. ENDIF IF plReverse lcString = FILETOSTR(pcfile) lcDecrypted = '' ? loCrypt.DecryptSessionBlockString(lcString, "x", @lcDecrypted ) STRTOFILE(m.lcDecrypted,pcfile) ELSE lcEncrypted = "" lcString = FILETOSTR(pcfile) ? loCrypt.EncryptSessionBlockString( lcString, "x", @lcEncrypted ) STRTOFILE(m.lcEncrypted,pcfile) ENDIF RETURN