Recent

Author Topic: DCPcrypt: encrypting with plain key  (Read 31575 times)

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: DCPcrypt: encrypting with plain key
« Reply #15 on: October 05, 2013, 03:11:11 pm »
Inside zip-archive only one file of 3kB StrSecInit.pas whith no implementation of any function. Of course, it does not even compiled. So what should I do with it?

You've downloaded only the patch.
So where is non-patch?
WinXP SP3 Pro Russian 32-bit (5.1.2600)

ChrisF

  • Hero Member
  • *****
  • Posts: 542

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: DCPcrypt: encrypting with plain key
« Reply #17 on: October 05, 2013, 03:50:16 pm »
Talk about spoon feeding...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: DCPcrypt: encrypting with plain key
« Reply #18 on: October 05, 2013, 05:36:26 pm »
So where is non-patch?

Obviously: http://sourceforge.net/projects/openstrsecii/files/openstrsecii/
Lazarus freezes when I try to convert delphi project to Lazarus project... Do you test your suggestion before post? Give me finished pascal-code of AES_set_decrypt_key, AES_set_encrypt_key and AES_cbc_encrypt ... Or  I will better use libyea32.dll from third-party installation.
WinXP SP3 Pro Russian 32-bit (5.1.2600)

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: DCPcrypt: encrypting with plain key
« Reply #19 on: October 05, 2013, 05:43:46 pm »
Are you truly threatening us that you will use a dll if we do not do the port for you?

In any case, please use the dll you have already decided what you need to use it is pointless to try anything else at this point.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: DCPcrypt: encrypting with plain key
« Reply #20 on: October 05, 2013, 06:22:55 pm »
Are you truly threatening us that you will use a dll if we do not do the port for you?

In any case, please use the dll you have already decided what you need to use it is pointless to try anything else at this point.
I have port ftp://ftp.openssl.org/source/openssl-1.0.0g.tar.gz \openssl-1.0.0g.tar\openssl-1.0.0g\crypto\aes\aes_core.c
but its function AES_set_decrypt_key does not gives same answer as Libyea32's :
http://pastebin.com/i3fZCq3q

I also try to port aes_x86core.c , but it gives different result too:
http://pastebin.com/52Tdq5md

Maybe it's nesessary to port assembler files \openssl-1.0.0g.tar\openssl-1.0.0g\crypto\aes\asm\.. but it's very hard for me. So the question is 'Will port work at all even with correct convertion?' If port will not work , then I will use binary DLL . But if there is my fail in port , I will continue trying to convert it.
« Last Edit: October 05, 2013, 06:46:25 pm by anna »
WinXP SP3 Pro Russian 32-bit (5.1.2600)

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DCPcrypt: encrypting with plain key
« Reply #21 on: October 06, 2013, 07:30:59 am »
So the question is 'Will port work at all even with correct convertion?'
Yes, everything can be ported and if it is ported correctly, it will work.

However, coding crypto code should be left to crypto experts. There are so many pitfalls in converting code from one language to another that it is far too dangerous to do some trial and error on crypto. You can easily end up with code that works only 99% of the cases. For crypto code 99,9999% is not even good enough. Stick to well tested libraries instead of wasting your time in trying to port crypto code. Even when you succeed decrypting your test file I wouldn't touch it with a barge pole. Kitchen sink crypto is no good and a real security hazard.

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: DCPcrypt: encrypting with plain key
« Reply #22 on: October 06, 2013, 07:39:04 am »
So the question is 'Will port work at all even with correct convertion?'
Even when you succeed decrypting your test file I wouldn't touch it with a barge pole. Kitchen sink crypto is no good and a real security hazard.

My task is only to decrypt  present encrypted files. And checking of successfully decrypting is very simple.
I'm not going to use openssl porting for security.

Well, as I see, even binary dll of ver. 0.9.8h gives different answer from dll of ver 1.0.0g. So OpenSSL comunity uses bad practice to change algorythm every version (but AES is standartized by US Department of Commerce in 2000 year  and must not be changed)... And it's better do not use OpenSSL products.
« Last Edit: October 06, 2013, 09:04:34 am by anna »
WinXP SP3 Pro Russian 32-bit (5.1.2600)

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: DCPcrypt: encrypting with plain key
« Reply #23 on: October 06, 2013, 03:04:24 pm »
Well, as I see, even binary dll of ver. 0.9.8h gives different answer from dll of ver 1.0.0g. So OpenSSL comunity uses bad practice to change algorythm every version (but AES is standartized by US Department of Commerce in 2000 year  and must not be changed)... And it's better do not use OpenSSL products.
openssl 0.9.8 and 1.0.0 are not binary compatible. You need to use different bindings. See http://upstream-tracker.org/pkgdiff_reports/openssl/0.9.8_to_1.0.1e/changes_report.html.

On my ubuntu system I have 122 packages installed that depend on openssl (Apache, dovecot, etc). I'm sure your recommendation to not use OpenSSL will receive a broad response ;D

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: DCPcrypt: encrypting with plain key
« Reply #24 on: October 07, 2013, 07:42:51 am »
... On my ubuntu system I have 122 packages installed that depend on openssl ...
You will lose your encrypted files when version updates. If you like it , go on.
... Yes, everything can be ported and if it is ported correctly, it will work. ...
I understand. But as I can see, OpenSSL uploads wrong sources (maybe for the purpose of nobody can replicate code and of all users use their binary).
« Last Edit: October 07, 2013, 07:47:49 am by anna »
WinXP SP3 Pro Russian 32-bit (5.1.2600)

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: DCPcrypt: encrypting with plain key
« Reply #25 on: October 07, 2013, 04:22:47 pm »
You're wrong: OpenSSL is really a well-known and pretty good cryptographic library, though it's not widely used in the windows environment.


Anyway, here is a standalone pascal implementation of the AES algorithm.

I've just extracted it from my own cryptographic library. The code is a pascal porting I've done a long time ago from a public C code version. I'm releasing it under a GNU Lesser General Public License (aka LGPL).

It's not perfect (a bit slow), neither using any CPU AES instruction set (if available), but it's working (I'm using it since a while, at least for the computed tables version - see hereafter). Tested with Lazarus/FPC 2.6.2/1.0.10/12 (windows 32 bits and 64 bits), and Delphi 7 (windows 32 bits).


Just a few words concerning this program:

-it's possible either to compute the necessary AES tables (smaller executable), or to use instead static tables (a bit faster version - though anyway the tables computation is only called once). See COMPAESTABLES define in AESPascal.pas to change it (computed AES tables by default). BTW, there is no need to call the AESGenTables procedure if the computed version is choosen; it's done automatically the first time an AES call is done.

-the Encrypt/Decrypt mode values are the opposite of the OpenSSL ones; so it's probably better to define them somewhere in your program, and then to use these defined values instead (see sample program attached).


I'm also attaching a sample program to show how to call the AES procedures/functions: both for a simple call and for a CBC call. It's the same sample program I've already proposed in this topic for OpenSSL, a few posts before. I've only added a third call to the sample calls (see button 4), to show how to "simulates" the same interface both for OpenSSL and this program.
« Last Edit: October 07, 2013, 04:27:52 pm by ChrisF »

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: DCPcrypt: encrypting with plain key
« Reply #26 on: October 07, 2013, 06:02:33 pm »
You're wrong...

Thank you very much!
Your  code decrypt my test file correctly! I can't believe this. It's amazing! ^_^
« Last Edit: October 07, 2013, 06:27:04 pm by anna »
WinXP SP3 Pro Russian 32-bit (5.1.2600)

 

TinyPortal © 2005-2018