Sign in to follow this  
Followers 0
Dreu

Decryption

3 posts in this topic

Okay so I have an issue I'm really curious about. I designed a program that obtains and saves information. To provide security for the end user, it encrypts the file so that when they post it, it can only be decrypted by its intended recipients.

Now... The encrypt AND decrypt functions work flawlessly when I run personal tests. ( Run the encryption on my PC, and decrypt on my PC...)

But when another person runs the program to encrypt the file, and gives me the file to decrypt... It doesn't decrypt it properly.

These are my encrypt/decrypt function:

#Include <Crypt.au3>

$File = @ScriptDir&"/testfile.txt"

_Decrypt()

Func _Encrypt()
    $success = _Crypt_EncryptFile($File, @ScriptDir&"/done.txt", "2817028170", $CALG_RC2)
    If $success Then
                MsgBox(0,"Success","Operation succeeded")
            Else
                Switch @error
                    Case 1
                        MsgBox(16,"Fail","Failed to create key")
                    Case 2
                        MsgBox(16,"Fail","Couldn't open source file")
                    Case 3
                        MsgBox(16,"Fail","Couldn't open destination file")
                    Case 4 or 5
                        MsgBox(16,"Fail","Encryption error")
                EndSwitch
            EndIf
EndFunc

Func _Decrypt()
    $success = _Crypt_DecryptFile(@ScriptDir&"/done.txt", @ScriptDir&"/done_done.txt", "2817028170", $CALG_RC2)
If $success Then
                MsgBox(0,"Success","Operation succeeded")
            Else
                Switch @error
                    Case 1
                        MsgBox(16,"Fail","Failed to create key")
                    Case 2
                        MsgBox(16,"Fail","Couldn't open source file")
                    Case 3
                        MsgBox(16,"Fail","Couldn't open destination file")
                    Case 4 or 5
                        MsgBox(16,"Fail","Encryption error")
                EndSwitch
            EndIf
EndFunc

Is there an issue with encrypting on one computer, and decrypting it on another?

Share this post


Link to post
Share on other sites



Hi Dreu,

I can confirm that in general there is no prob with encrypting on one pc and decrypting on another, well, I use $CALG_AES_256 and strings rather than whole files.

Do you not have more than 1 pc handy that you could test this with?

You might want to verify the filesize of the file being passed to you vs the filesize of the file encrypted on your own pc.

What error do you get?

4Eyes

Share this post


Link to post
Share on other sites

Like I said, If I encrypt it on my computer, I can decrypt it just fine.

But if someone else encrypts it, when I try to decrypt it, it doesn't work.

What happens when someone else encrypts it:

When I try to decrypt it all it shows is "ÿÿÿÿ"

No errors. It says it has completed successfully. It makes absolutely no sense that it works on one computer, and doesn't on another. Is there a algorithm that works across all computers?

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  
Followers 0