Welcome to the Xceed Community | Help
Community Search  
More Search Options

Visual FoxPro and Encryption Library

Sort Posts: Previous Next
  •  01-07-2005, 6:49 PM Post no. 6099

    Visual FoxPro and Encryption Library


    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.
  •  01-10-2005, 8:22 AM Post no. 6100 in reply to 6099

    Re: Visual FoxPro and Encryption Library

    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.

    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  11-27-2005, 9:54 PM Post no. 6106 in reply to 6099

    Re: Visual FoxPro and Encryption Library

    HI
    i wonder if i could have that sample?
    please.


    thankyou
  •  04-25-2006, 3:03 AM Post no. 6101 in reply to 6100

    note

    hi
    what this here
    xceed encryption1: the specified file name dose not exist
    thanhkyou
  •  04-25-2006, 3:04 AM Post no. 6102 in reply to 6101

    inportan

    what this here
    "xceed encryption1: the specified file name dose not exist "
    thanhkyou
  •  04-26-2006, 2:32 PM Post no. 6103 in reply to 6102

    Re: inportan

    Could you give more details on the problem that you are having?
    André
    Software Developer
    Xceed Software Inc.
  •  05-01-2006, 11:43 PM Post no. 6104 in reply to 6103

    Re: inportan


    ************ 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 CriticalXCeedError

    PROCEDURE 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
    ENDPROC

    FUNCTION GetLastError
    RETURN THIS.lcLastError
    ENDFUNC

    PROCEDURE DESTROY
    * Release used objects
    RELEASE xEnc, xRSA, xTwo, xSHA, xZIP
    THIS.RemoveTempDirectory()
    ENDPROC


    PROCEDURE 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)
    ENDFUNC

    FUNCTION RSAGenerateKeys
    * Function used to generate pair of public & private keys
    * Usage:
    * RSAGenerateKeys("C:\tmp\private.key", "C:\tmp\public.key", 2048) SDJX
  •  05-01-2006, 11:50 PM Post no. 6105 in reply to 6104

    Re: inportan

    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.
  •  09-13-2009, 10:58 PM Post no. 23910 in reply to 6099

    Re: Visual FoxPro and Encryption Library

    dear vazagothic, do you have an vfp 9 encrypt sample, woulg\d you like to share with me?

    (agungkw@ovi.com)

    Crying 

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.