Home › Forums › ActiveX components › Xceed Encryption for ActiveX › Visual FoxPro and Encryption Library
-
AuthorPosts
-
#42883 |
It seems that the Xceed’s Knowledge Base still shows the WRONG information about Xceed’s Encryption not working with VFP. With some tweaking I made it work with VFP8/9 and even with 6 (some procedures don’t work though)
If someone’s interested in a sample, please contact me.
Imported from legacy forums. Posted by Vazagothic (had 12827 views)
Hello,
If you have a sample that correctly works with Visual FoxPro, you can send it to support@xceedsoft.com. They will take a look at it and post it to the Code Sample Repository.
Imported from legacy forums. Posted by Jenny [Xceed] (had 605 views)
HI
i wonder if i could have that sample?
please.thankyou
Imported from legacy forums. Posted by davidhh (had 799 views)
hi
what this here
xceed encryption1: the specified file name dose not exist
thanhkyouImported from legacy forums. Posted by inportan (had 873 views)
what this here
“xceed encryption1: the specified file name dose not exist “
thanhkyouImported from legacy forums. Posted by inportan (had 800 views)
Could you give more details on the problem that you are having?
Imported from legacy forums. Posted by André (had 861 views)
************ CUT HERE **************
* Xceed’s Product Keys to use with Encryption (efpLicenseKey) and ZIP Compression (zfpLicenseKey)
* We may want to storem them in some encrypted way, so it would be a little bit harder to extract
* them from the code
*
#DEFINE efpLicenseKey “PUT YOUR COMPRESSION KEY HERE”
#DEFINE zfpLicenseKey “PUT YOUR ENCRYPTION KEY HERE”
#DEFINE efpDEVersion “0.2a” && Version of Digital Envelope algorithm (may be useful later)* First line of PUBLIC/PRIVATE Ascii Armored Key
#DEFINE EOL CHR(13)+CHR(10) && End of Line
#DEFINE efPublicStringB “—–BEGIN PUBLIC KEY BLOCK—–” + EOL
#DEFINE efPrivateStringB “—–BEGIN PRIVATE KEY BLOCK—–” + EOL* Last line of PUBLIC/PRIVATE Ascii Armored Key
#DEFINE efPublicStringE EOL + “—–END PUBLIC KEY BLOCK—– ”
#DEFINE efPrivateStringE EOL + “—–END PRIVATE KEY BLOCK—– ”* Different settings for compression and encryption
#DEFINE SHA_HASH_SIZE 512
#DEFINE TWOFISH_ENCRYPTION_MODE 0 && Electronic Code Book (ECB) = 0, Cipher Block Chaining (CBC) = 1
#DEFINE TWOFISH_PADDING_METHOD 2 && FIPS81 = 0, Random = 1, RFC1423 = 2
#DEFINE COMPRESSION_LEVEL 9 && Normal Compression = 6, Highest Compression = 9*
#DEFINE efpEncrypt 0
#DEFINE efpDecrypt 1
#DEFINE efpHash 2
#DEFINE efpSign 3
#DEFINE efpVerify 4* Xceed Compression control error codes
#DEFINE xceSuccess 0
#DEFINE xceSessionOpened 1000
#DEFINE xceInitCompression 1001
#DEFINE xceUnknownMethod 1002
#DEFINE xceCompression 1003
#DEFINE xceInvalidPassword 1004
#DEFINE xceChecksumFailed 1005
#DEFINE xceDataRemaining 1006
#DEFINE xceNotLicensed 1007
#DEFINE xceBusy 1008
* Xceed Zip control error codes
#DEFINE xerSuccess 0
#DEFINE xerProcessStarted 1
#DEFINE xerWarnings 526
#DEFINE xerFilesSkipped 527
* All other error codes of type xcdError:
#DEFINE xerEmptyZipFile 500
#DEFINE xerSeekInZipFile 501
#DEFINE xerEndOfZipFile 502
#DEFINE xerOpenZipFile 503
#DEFINE xerCreateTempFile 504
#DEFINE xerReadZipFile 505
#DEFINE xerWriteTempZipFile 506
#DEFINE xerWriteZipFile 507
#DEFINE xerMoveTempFile 508
#DEFINE xerNothingToDo 509
#DEFINE xerCannotUpdateAndSpan 510
#DEFINE xerMemory 511
#DEFINE xerSplitSizeTooSmall 512
#DEFINE xerSFXBinaryNotFound 513
#DEFINE xerReadSFXBinary 514
#DEFINE xerCannotUpdateSpanned 515
#DEFINE erBusy 516
#DEFINE xerInsertDiskAbort 517
#DEFINE xerUserAbort 518
#DEFINE xerNotAZipFile 519
#DEFINE xerUninitializedString 520
#DEFINE xerUninitializedArray 521
#DEFINE xerInvalidArrayDimensions 522
#DEFINE xerInvalidArrayType 523
#DEFINE xerCannotAccessArray 524
#DEFINE xerUnsupportedDataType 525
#DEFINE xerDiskNotEmptyAbort 528
#DEFINE xerRemoveWithoutTemp 529
#DEFINE xerNotLicensed 530
#DEFINE xerInvalidSfxProperty 531
#DEFINE xerInternalError 999
* xcdValueType enumeration
#DEFINE xvtError 0
#DEFINE xvtWarning 1
#DEFINE xvtSkippingReason 2* CONSTANTS for TwoFish + RSA Encryption procedures
* Can be modified freely .. or so I believe
#DEFINE ccTwoFishKeyRSAFile “TwoFishKey.rsa”
#DEFINE ccTwoFishOutputFile “HZTFile.two”
#DEFINE ccZIPInOutFile “HZFile.zip”
#DEFINE ccInputFileNameFile “InputFile.txt”DEFINE CLASS Encrypt_Decrypt AS Custom
PROTECTED xEnc, xRSA, xTwo, xZip, xSHA, lcLastError, lcZIPInOutDir
PROTECTED CriticalXCeedErrorPROCEDURE INIT
THIS.CriticalXceedError = 0
THIS.lcLastError = “”
THIS.lcZIPInOutDir = “”
TRY
* ZIP Library – INIT
THIS.xZIP = CreateObject(‘XceedSoftware.XceedZip.5’)
THIS.xZIP.License(zfpLicenseKey)
THIS.xZIP.CompressionLevel = COMPRESSION_LEVEL* RSA encryption – INIT
THIS.xEnc = CreateObject(‘Xceed.Encryption.1’)
THIS.xEnc.License(efpLicenseKey)THIS.xRSA = CreateOBject(‘Xceed.RSAEncryptionMethod.1’)
* Use the SHA1 160-bit hashing by default
THIS.xSHA = CREATEOBJECT(“Xceed.SHAHashingMethod.1”)
THIS.xSHA.HashSize = SHA_HASH_SIZE* Decode the Encrypted TwoFish file with the code we just got ..
THIS.xTwo = CreateOBject(‘Xceed.TwofishEncryptionMethod.1’)THIS.xTwo.HashingMethod = THIS.xSHA && use SHA1 for hashing the password
THIS.xTwo.EncryptionMode = TWOFISH_ENCRYPTION_MODE && emoChainedBlocks
THIS.xTwo.PaddingMethod = TWOFISH_PADDING_METHOD && epmRFC1423
THIS.xTwo.SetRandomInitVector() && Set the InitVector property with a random value
CATCH TO oErr WHEN .T.
THIS.lcLastError = oErr.Message
THIS.CriticalXceedError = -888
ENDTRY
ENDPROCFUNCTION GetLastError
RETURN THIS.lcLastError
ENDFUNCPROCEDURE DESTROY
* Release used objects
RELEASE xEnc, xRSA, xTwo, xSHA, xZIP
THIS.RemoveTempDirectory()
ENDPROCPROCEDURE RemoveTempDirectory
IF DIRECTORY(THIS.lcZipInOutDir)
lcOldSafety = SET(“Safety”)
SET SAFETY OFF
TRY
* Erase the temporary directory content and the directory itself
* Catch all problems if possible, don’t error, since it’s not so important
DELETE FILE THIS.lcZIPInOutDir + “\*.*”
RMDIR SET(‘DEFAULT’) + CURDIR() + THIS.lcZIPInOutDir
CATCH TO oErr WHEN .T.
THIS.lcLastError = “Error cleaning the content of temporary directory”
ENDTRY
SET SAFETY &lcOldSafety
ENDIF
ENDPROC* Tests the ZIP file for errors
FUNCTION ZIPTest
PARAMETERS lcInputFile
THIS.xZIP.ZipFilename = lcInputFile
RETURN THIS.xZIP.TestZipFile(True)
ENDFUNCFUNCTION RSAGenerateKeys
* Function used to generate pair of public & private keys
* Usage:
* RSAGenerateKeys(“C:\tmp\private.key”, “C:\tmp\public.key”, 2048) SDJXImported from legacy forums. Posted by Vazagothic (had 1388 views)
This code WORKS in VFP9 and VFP8 (as well as VFP6, but you CANNOT generate Keys in VFP6 due to problems with CHR(0)).
Xceed – PLEASE, UPDATE your Knowledge Database 🙂
And to answer some questions – I am the author of the code.
Imported from legacy forums. Posted by Vazagothic (had 6448 views)
dear vazagothic, do you have an vfp 9 encrypt sample, woulg\d you like to share with me?
(agungkw@ovi.com)
[:'(]
Imported from legacy forums. Posted by agung kusumo (had 4975 views)
-
AuthorPosts
- You must be logged in to reply to this topic.