Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Encrypted storage with streaming (OpenSSL, AES)
Re: Encrypted storage with streaming (OpenSSL, AES) [message #25811 is a reply to message #25774] Fri, 12 March 2010 21:41 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

It will take some time before I switch to AES again. But I will.
Re: Encrypted storage with streaming (OpenSSL, AES) [message #25828 is a reply to message #25811] Sun, 14 March 2010 15:27 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3404
Registered: August 2008
Senior Veteran
Mindtraveller wrote on Fri, 12 March 2010 21:41

It will take some time before I switch to AES again. But I will.

Smile


Best regards
Iñaki
bazaar: DeEncrypter [message #27832 is a reply to message #25828] Thu, 05 August 2010 21:09 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
in bazaar is a DeEncrypter based on AESStream. i hope i am using it right (Mindtraveller could review it). it works so far, but only for files < 200 MB or so (allocator breaks with Out of Memory sometime, if file too big, it's the upp allocator i am using, default case).

so the matter is, it can import keys. and could be extended with a functionality to derive the key from a user password...

but best would be to have a port for RSA asymetrical encryption. then one could encrypt the key and leave it encrypted with the public key, stay with the data somewhere, and 'unlock' (decrypt) it with the password, which would result somehow in the private key.

as far as i remember the major encryption programs do it the same Smile, maybe more fancy
Re: bazaar: DeEncrypter [message #27865 is a reply to message #27832] Sat, 07 August 2010 07:14 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

kohait00 wrote on Thu, 05 August 2010 23:09

in bazaar is a DeEncrypter based on AESStream. i hope i am using it right (Mindtraveller could review it). it works so far, but only for files < 200 MB or so (allocator breaks with Out of Memory sometime, if file too big, it's the upp allocator i am using, default case).
Which package/file is to look at?
Re: bazaar: DeEncrypter [message #27871 is a reply to message #27865] Sun, 08 August 2010 11:05 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
the package is named 'DeEncrypter', there is no ref in uppweb yet, it's too young Smile
Re: bazaar: DeEncrypter [message #27908 is a reply to message #27871] Tue, 10 August 2010 15:33 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

If I'm not mistaken, you load each file into the memory and then encrypt/decrypt it. If it's right, then you do wrong way.

The main idea behind AESStream classes is streaming. This means you don't need to load the file into memory. All you need is to open file and read its contents by small chunks into AESStream class then taking encrypted(decrypted) chunks from it into other file. You don't have to load file into memory. You don't have to handle large String object within your code.

I think the fact you have exception for large files means you should switch to chunks and streaming and refuse loading whole file into memory.
Re: bazaar: DeEncrypter [message #27910 is a reply to message #27908] Tue, 10 August 2010 15:46 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
yes, absolutely.

this was a quick shot, i needed it for my app, delivering some additional ressource files, which should be 'scrambled' Smile for small files it works with no issues, i just wanted to try it with larger files ofcorse.

i am not very familiar with the Stream stuff in upp yet, but definitely need to..

meanwhile, i dont mind anyone to change the behaviour accordingly, this could, infact, be a true life example of how to do streaming processing with AESStream..if you already know what to change, feel free to do so Smile i might do it as soon as i have some more info on that and some more time.. like always.

cheers
Re: bazaar: DeEncrypter [message #27918 is a reply to message #27910] Tue, 10 August 2010 21:14 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Please read AESStream package help page. It has example of "right" approach to streaming. If you have any further questions please feel free to ask.

P.S. koldo, I remember I've promised to embed key generation functionality and I will do it in the near future. Excuse my delay.
Re: bazaar: DeEncrypter [message #27923 is a reply to message #27918] Tue, 10 August 2010 21:42 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
i've looked there before.but couldnt quite get well with the example.. after all, you too are using Strings sIn and sOut to contain loaded and generated data. i suppose i need to use FileStream at that point, and call flush from time to time...


Re: bazaar: DeEncrypter [message #27935 is a reply to message #27923] Wed, 11 August 2010 09:43 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

I've finally embedded user password hashing into AESStream classes. This means you may use password as argument without any potential security problems. AESStream classes calculate SHA256 hash from your password and use it as a key.

koldo, could you please take this archive and update packages in bazaar? There is also a new version of MtAlt there. Thanks in forward.
  • Attachment: bazaar.zip
    (Size: 350.46KB, Downloaded 380 times)
Re: bazaar: DeEncrypter [message #27943 is a reply to message #27935] Wed, 11 August 2010 15:29 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3404
Registered: August 2008
Senior Veteran
Excellent.

Now plain user password can be used!

Two things:

- As class has changed, old encrypted strings and keys do not match Sad. Could you add the user password possibility not by default? (as it was before)

- In AESHashedString() you could just use SHA256String() function in Sha.cpp file Smile.




Best regards
Iñaki

[Updated on: Wed, 11 August 2010 15:30]

Report message to a moderator

Re: bazaar: DeEncrypter [message #27964 is a reply to message #27943] Thu, 12 August 2010 10:22 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

koldo wrote on Wed, 11 August 2010 17:29

- As class has changed, old encrypted strings and keys do not match Sad. Could you add the user password possibility not by default? (as it was before)
- In AESHashedString() you could just use SHA256String() function in Sha.cpp file Smile.

1) Yes. I'll make new classes with new names for updated behaviour, while old ones will behave like before.
2) No, I can't. SHA256String returns hex-formatted string, not hash itself.
Re: bazaar: DeEncrypter [message #27969 is a reply to message #27964] Thu, 12 August 2010 13:54 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3404
Registered: August 2008
Senior Veteran
Perfect!

Best regards
Iñaki
Re: bazaar: DeEncrypter [message #28117 is a reply to message #27969] Tue, 17 August 2010 15:58 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
DeEncrypter is now streaming the files properly (i hope).
if you could get a look into it...
the user password thing could be encorporated there as an extra button.. for loading the SHA256 key.. but i'm not yet familiar with this.
Re: bazaar: DeEncrypter [message #31369 is a reply to message #28117] Fri, 25 February 2011 18:52 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3404
Registered: August 2008
Senior Veteran
Hello All

Now, as it should be from the beginning, SHA256String() and rest of SHA2 functions return the SHA hash in binary.

For all SHA2 functions there is a version that return the hash in Hex, like SHA256Hex().


Best regards
Iñaki
Re: bazaar: DeEncrypter [message #32089 is a reply to message #31369] Thu, 21 April 2011 14:28 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Currently I'm using AESStream heavily and must admit that automatic SHA hash from password provided is not a must. In a number of situation the original password is still needed.
Re: Encrypted storage with streaming (OpenSSL, AES) [message #40608 is a reply to message #23087] Fri, 23 August 2013 01:59 Go to previous message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
Hello, is AESStream compatible with php ?
http://www.php.net/manual/en/function.mdecrypt-generic.php

I can't decrypt my messages using
http://aes.online-domain-tools.com/

(AES with 32 byte key in CBC mode)


Also I'm quite confused that there is no AES_decrypt() call anywhere in AESDecoderStream?

[Updated on: Fri, 23 August 2013 02:01]

Report message to a moderator

Previous Topic: Protect packages - split code encryption,client and server
Next Topic: Added single and double linked lists
Goto Forum:
  


Current Time: Sat Dec 14 11:06:17 CET 2024

Total time taken to generate the page: 0.03660 seconds