Jump to content
Sign in to follow this  

Regarding crypt include file

Recommended Posts

I seem to be having a problem with the encrypt function.

The include file is #Include <Crypt.au3>

My code is below and what it seems is that I run the encrypt function once, it encrypts the file correctly, I run it again exactly the same function and it decrypts.

I'm thinking its a problem with the include as my code is very basic and I'm simply using the encrypt function. Makes it difficult to encrypt and decrypt properly.

Anyone know if running the _Crypt_EncryptFile function twice over the same file with same algorithm and password/crypt key unencrypts the file?

func encryptfile($sSourceFile, $sDestinationFile,$vpassword,$vfiletype)


If FileExists($sSourceFile) Then
    msgbox(0,"EON Error Message","Can't find "&$vfiletype&". Looking for "&$vpath&$vfilename)

if $vpassword<>"" Then
    msgbox(0,"EON Error Message","No password found for "&$vfiletype&" .")

if $errmessen<>"true" Then
$vCryptKey=_Crypt_DeriveKey($vPassword,$CALG_RC4 )
_Crypt_EncryptFile($sSourceFile, $sDestinationFile, $vCryptKey, $iALG_ID)
_Crypt_DestroyKey( $vCryptKey)
FileCopy($sDestinationFile, $sSourceFile,1)
    msgbox(0,"EON Error Message","Error saving file. Cancelling "&$vfiletype&" save.")




Edited by johnjamie

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...