PHP > 5.2 aesCrypt complient class

Discussion related to AES Crypt, the file encryption software for Windows, Linux, Mac, and Java.
Post Reply
IgoAtM
Posts: 3
Joined: Wed Dec 11, 2013 8:32 am

PHP > 5.2 aesCrypt complient class

Post by IgoAtM » Wed Dec 11, 2013 9:05 am

For any one that may be interested please find attached a php aesCrypt compliant class
It was generated from the ground up by myself so I choose to release it under LGPL
unless that is inconvenient in which case post me and I will discuss
It was written for php 5.2+ but if anyone would like a retro version
I should be able to cobble one up.
The class has been used as an encryption decryption engine within a tar class
to archive processed orders and dose so with out failure however
It has never undergone any serious testing so it is really beta I guess if there are issues
please let me know and I will see what I can do to respond to them.
I have left lots of coding comments in the file to help any one that wishes to
hack at the script
enjoy :-)
Attachments
class.aesCrypt.php.txt
aesCrypt.class.php
(16.15 KiB) Downloaded 1313 times

User avatar
paulej
Posts: 501
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: PHP > 5.2 aesCrypt complient class

Post by paulej » Sat Jan 03, 2015 7:23 pm

Since this is starting to get lost in the pile of messages, I posted a link directly to this from the "download" page on AES Crypt: https://www.aescrypt.com/download/

User avatar
pelle
Posts: 6
Joined: Wed Jan 27, 2016 5:54 pm

Re: PHP > 5.2 aesCrypt complient class

Post by pelle » Wed Jan 27, 2016 6:10 pm

Hi,
thanks for this easy to use class. It runs fairly fast as well.

I've discovered a bug, though:

A text file created by Windows Notepad is not the same after first encrypting it and the decrypting it:

a) Windows linebreaks are substituted by Linux linebreaks.
b) A lot of "nul":s are appended at the end.

I happened to make hashes of the files and noticed a difference. Thus I studied the files in detail.

I've verified that this doesn't happen when I use AES Crypt for Windows (or other encryption or compression software).

IgoAtM
Posts: 3
Joined: Wed Dec 11, 2013 8:32 am

Re: PHP > 5.2 aesCrypt complient class

Post by IgoAtM » Sun Jan 31, 2016 9:08 pm

Thanks for your bug response. It has been a long time since I last looked at the class so I will need to get backup to speed but will investigate

IgoAtM
Posts: 3
Joined: Wed Dec 11, 2013 8:32 am

Re: PHP > 5.2 aesCrypt complient class

Post by IgoAtM » Mon Feb 01, 2016 12:36 am

Had a very quick look at the windows line endings issue you raised and I am having problems duplicating the problem on my setup.
running php (5.6.3) via a command line interface on my Linux OS I have inserted a windows formatted text document line endings 0x0d 0x0a and I have viewed the document pre encoding via a hex editor just to confirm the line endings are indeed windows formatted.
I then decoded the file using the standard aescrypt not the php version and it seems a exact duplicate with line endings intact and for the correct OS again cross checked via a look at the generated file via a hex editor.
I think in order to better trace any issue I will need to be able to duplicate the setup you are using.
Need information on what server the php script is running upon.
If you encode and decode via the php script or use the standard cli for either process.
what OS you are using.

User avatar
pelle
Posts: 6
Joined: Wed Jan 27, 2016 5:54 pm

Re: PHP > 5.2 aesCrypt complient class

Post by pelle » Mon Feb 01, 2016 7:27 pm

Hi,
I will answer you privately about my config.

With your kind consent have I now published a fork at GitHub called AESCrypt-PHP and licensed it under the GPL v.3 license, instead of LGPL. I've included a fix for the padding isssue.

User avatar
pelle
Posts: 6
Joined: Wed Jan 27, 2016 5:54 pm

Re: PHP > 5.2 aesCrypt complient class

Post by pelle » Tue Feb 02, 2016 11:31 am

Hi again,
here's the link to my fork called AESCrypt-PHP:
https://github.com/havet/AESCrypt-PHP
Enjoy!

User avatar
pelle
Posts: 6
Joined: Wed Jan 27, 2016 5:54 pm

Re: PHP > 5.2 aesCrypt complient class

Post by pelle » Wed Feb 03, 2016 10:26 am

The line-endings-issue is solved.

As the original author, IgoAtM, claimed all the time, the line-endings-problem was due to a transfer problem. Transferring the files with ftp in "automatic" mode sent the files in "text mode" - thus translating the line endings between local and remote. A comparison with a transfer with http was revealing.

Moral: you'd better always transfer files with ftp in binary mode.

The original version of this program doesn't remove padding on decryption.

My fork of his library works as expected and is perfectly compatible with other AESCrypt programs e.g. AESCrypt for Windows:
https://github.com/havet/AESCrypt-PHP

Maybe I could get a link to the repository at the download page?

User avatar
paulej
Posts: 501
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: PHP > 5.2 aesCrypt complient class

Post by paulej » Wed Feb 03, 2016 3:47 pm

We should have a link to each implementation, but I think it's unfortunate to have links to multiple forks of the same code.

IgoAtM, do you have your own repository? I only have a link to your original post here. Can you look at the code difference and see if you need to make changes?

I guess to both of you: can you collaborate and reach agreement on one common code base to reference? If that's pelke's repo, I'm OK with that as an outcome.

Post Reply

Return to “AES Crypt”

Who is online

Users browsing this forum: No registered users and 2 guests