Re: Encrypt the big file with symmetric algorithm

2007-05-19 Thread Harald Latzko

Hi!

I tried to compile your code, but the following include files are  
missing (or not included in MacOS, Linux and openSSL distribution):

- portable.h
- exception.h
- ltscrypto.h
- logger.h

Can you tell me where to find these? Thank you!

Regards,
Harald

Am 18.05.2007 um 22:51 schrieb Chaz.:

Here are examples, from my code, of both 3DES and AES. Any  
questions, ask away.


Chaz.

Harald Latzko wrote:

Hi!
Do you have a solution for deryption of big files using des3 and/ 
or aes256, too? The openSSL command line smime utility eats up all  
my memory and crashes after a while...

Greetings,
Harald
Am 17.05.2007 um 01:15 schrieb Chaz.:

[EMAIL PROTECTED] wrote:

Hi, all
I have encrypted the file with the manpage example (blowfish),  
and then
decrypt it. It will be fine if I try some small files, however,  
when I

test some big files (e.g.: 100M), the decryption will not work.
Is there anybody can suggest me an available way to do big file
encryption and decryption with symmetric algorithm?
Any comments/suggestions will be welcome!
Best regards Gong


This should do what you want. Any questions just ask.

Chuck Wegrzyn

blowfish.c
_ 
_
OpenSSL Project http:// 
www.openssl.org
User Support Mailing Listopenssl- 
[EMAIL PROTECTED]
Automated List Manager
[EMAIL PROTECTED]


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Encrypt the big file with symmetric algorithm

2007-05-19 Thread Chaz.

Harald,

 They are specific to my system. Let me edit the file for you to do 
exactly what you need. It will give you a model to work from. Which 
would you like me to do: AES, 3DES or BLOWFISH?


Peace,
Charles

Harald Latzko wrote:

Hi!

I tried to compile your code, but the following include files are 
missing (or not included in MacOS, Linux and openSSL distribution):

- portable.h
- exception.h
- ltscrypto.h
- logger.h

Can you tell me where to find these? Thank you!

Regards,
Harald

Am 18.05.2007 um 22:51 schrieb Chaz.:

Here are examples, from my code, of both 3DES and AES. Any questions, 
ask away.


Chaz.

Harald Latzko wrote:

Hi!
Do you have a solution for deryption of big files using des3 and/or 
aes256, too? The openSSL command line smime utility eats up all my 
memory and crashes after a while...

Greetings,
Harald
Am 17.05.2007 um 01:15 schrieb Chaz.:

[EMAIL PROTECTED] wrote:

Hi, all
I have encrypted the file with the manpage example (blowfish), and 
then

decrypt it. It will be fine if I try some small files, however, when I
test some big files (e.g.: 100M), the decryption will not work.
Is there anybody can suggest me an available way to do big file
encryption and decryption with symmetric algorithm?
Any comments/suggestions will be welcome!
Best regards Gong


This should do what you want. Any questions just ask.

Chuck Wegrzyn

blowfish.c
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]



__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Encrypt the big file with symmetric algorithm

2007-05-19 Thread Harald Latzko

Hi!

AES256-CBC and 3DES-EDE-CBC-3key would be the algorithm used by me.  
(AES with a higher priority).


Thank you in advance,
Harald

Am 19.05.2007 um 18:43 schrieb Chaz.:


Harald,

 They are specific to my system. Let me edit the file for you to do  
exactly what you need. It will give you a model to work from. Which  
would you like me to do: AES, 3DES or BLOWFISH?


Peace,
Charles

Harald Latzko wrote:

Hi!
I tried to compile your code, but the following include files are  
missing (or not included in MacOS, Linux and openSSL distribution):

- portable.h
- exception.h
- ltscrypto.h
- logger.h
Can you tell me where to find these? Thank you!
Regards,
Harald
Am 18.05.2007 um 22:51 schrieb Chaz.:
Here are examples, from my code, of both 3DES and AES. Any  
questions, ask away.


Chaz.

Harald Latzko wrote:

Hi!
Do you have a solution for deryption of big files using des3 and/ 
or aes256, too? The openSSL command line smime utility eats up  
all my memory and crashes after a while...

Greetings,
Harald
Am 17.05.2007 um 01:15 schrieb Chaz.:

[EMAIL PROTECTED] wrote:

Hi, all
I have encrypted the file with the manpage example (blowfish),  
and then
decrypt it. It will be fine if I try some small files,  
however, when I

test some big files (e.g.: 100M), the decryption will not work.
Is there anybody can suggest me an available way to do big file
encryption and decryption with symmetric algorithm?
Any comments/suggestions will be welcome!
Best regards Gong


This should do what you want. Any questions just ask.

Chuck Wegrzyn

blowfish.c
___ 
___
OpenSSL Project http:// 
www.openssl.org
User Support Mailing Listopenssl- 
[EMAIL PROTECTED]
Automated List Manager
[EMAIL PROTECTED]
_ 
_
OpenSSL Project http:// 
www.openssl.org
User Support Mailing Listopenssl- 
[EMAIL PROTECTED]
Automated List Manager
[EMAIL PROTECTED]


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]



__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Encrypt the big file with symmetric algorithm

2007-05-18 Thread Chaz.
Here are examples, from my code, of both 3DES and AES. Any questions, 
ask away.


Chaz.

Harald Latzko wrote:

Hi!

Do you have a solution for deryption of big files using des3 and/or 
aes256, too? The openSSL command line smime utility eats up all my 
memory and crashes after a while...


Greetings,
Harald

Am 17.05.2007 um 01:15 schrieb Chaz.:


[EMAIL PROTECTED] wrote:

Hi, all
I have encrypted the file with the manpage example (blowfish), and then
decrypt it. It will be fine if I try some small files, however, when I
test some big files (e.g.: 100M), the decryption will not work.
Is there anybody can suggest me an available way to do big file
encryption and decryption with symmetric algorithm?
Any comments/suggestions will be welcome!
Best regards Gong


This should do what you want. Any questions just ask.

Chuck Wegrzyn

blowfish.c

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]





#include stdio.h
#include stdlib.h
#include unistd.h
#include sys/types.h
#include sys/stat.h
#include sys/file.h   // flock
#include fcntl.h
#include string.h
#include errno.h

#include openssl/evp.h
#include openssl/err.h

#include portable.h
#include exception.h
#include dir.h
#include ltscrypto.h
#include logger.h

#include crypto.h

extern Exc_t   enomore;
extern Exc_t   ecrypto;


#ifndef CRYPT_BUFSIZE
#define CRYPT_BUFSIZE(1024)
#endif

typedef struct {
EVP_CIPHER_CTX ctx;
  t_key_iv kiv;
   int first;
   } t_CONTEXT,*p_CONTEXT;


static void EncryptData(const EVP_CIPHER *cipher,int inFid, int outFid, char 
*key, char *iv, const char *pTitle)
 THROWS(efile)
 THROWS(ecrypto)
{
unsigned char buffer[CRYPT_BUFSIZE],obuffer[2*CRYPT_BUFSIZE];
int oLen,iLen;
// Setup the crypto context...
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(ctx);
EVP_EncryptInit_ex(ctx,cipher, NULL, key,iv);

// Until we exhaust input file data...
for( ;1; )
{
// Set the buffer to zeros...
memset(buffer,0,sizeof(buffer));

// Read in some data. If it comes back 0, we are done.
iLen = read(inFid,buffer,sizeof(buffer));
if( 0 == iLen ) break;
if( -1 == iLen ) { eraise2(efile, ((%s) : File read error 
(%s),pTitle,strerror(errno))); }

// Encrypt it now.
if( 0 == EVP_EncryptUpdate(ctx,obuffer,oLen,buffer,iLen) )
   {
unsigned long int x = ERR_get_error();
char szBuff[256];
ERR_error_string_n(x,szBuff,sizeof(szBuff));
eraise2(ecrypto,(szBuff));
   }
iLen = write(outFid,obuffer,oLen);
if( -1 == iLen ) { eraise2(efile, ((%s) : File write error 
(%s),pTitle,strerror(errno))); }
}

// Finish up taking whatever is left in the encryption system and writing 
it out...
if( 0 == EVP_EncryptFinal_ex(ctx,obuffer,oLen) )
{
unsigned long int x = ERR_get_error();
char szBuff[256];
ERR_error_string_n(x,szBuff,sizeof(szBuff));
eraise2(ecrypto,(szBuff));
}
iLen = write(outFid,obuffer,oLen);
if( -1 == iLen ) { eraise2(efile, ((%s) : File write error 
(%s),pTitle,strerror(errno))); }

// Cleanup..
EVP_CIPHER_CTX_cleanup(ctx);
}


static void DecryptData(const EVP_CIPHER *cipher,int inFid, int outFid, char 
*key, char *iv, const char *pTitle)
{
unsigned char buffer[CRYPT_BUFSIZE],obuffer[2*CRYPT_BUFSIZE];
int oLen,iLen;
// Initialize things.
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(ctx);
EVP_DecryptInit_ex(ctx, cipher, NULL, key, iv);

// PRocess the file until we are done with it
for( ;1; )
{
// Get some file input...
memset(buffer,0,sizeof(buffer));
iLen = read(inFid,buffer,sizeof(buffer));

// If there is no more, we are done.
if( 0 == iLen ) break;
if( -1 == iLen ) { eraise2(efile, ((%s) : File read error 
(%s),pTitle,strerror(errno))); }

// Decrypt it.
if( 0 == EVP_DecryptUpdate(ctx,obuffer,oLen,buffer,iLen) )
   {
unsigned long int x = ERR_get_error();
char szBuff[256];
ERR_error_string_n(x,szBuff,sizeof(szBuff));
eraise2(ecrypto,(szBuff));
   }

// Write things out...
iLen = write(outFid,obuffer,oLen);
if( -1 == iLen ) { eraise2(efile, ((%s) : File read error 
(%s),pTitle,strerror(errno))); }
}

// Collect the final 

Encrypt the big file with symmetric algorithm

2007-05-16 Thread JGong
Hi, all

I have encrypted the file with the manpage example (blowfish), and then
decrypt it. It will be fine if I try some small files, however, when I
test some big files (e.g.: 100M), the decryption will not work.

Is there anybody can suggest me an available way to do big file
encryption and decryption with symmetric algorithm?

Any comments/suggestions will be welcome!

Best regards 
Gong


===
The privileged confidential information contained in this email is intended for 
use only by the addressees as indicated by the original sender of this email. 
If you are not the addressee indicated in this email or are not responsible for 
delivery of the email to such  a person, please kindly reply to the sender 
indicating this fact and delete all copies of it from your computer and network 
server immediately. Your cooperation is highly appreciated. It is advised that 
any unauthorized use of confidential information of Winbond is strictly 
prohibited; and any information in this email irrelevant to the official 
business of Winbond shall be deemed as neither given nor endorsed by Winbond.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Encrypt the big file with symmetric algorithm

2007-05-16 Thread Harald Latzko

Hi!

I use for big file encryption the new stream support of openSSL  
0.9.9, it works perfectly. For decryption (and signature  
verification), the stream support is not implemented yet. So we have  
to wait until it's implemented, or find another solution. If you have  
found another way to do this job, please let me know, since I'm  
really interested in a working mechanism too.


Regards,
Harald


Am 16.05.2007 um 12:10 schrieb [EMAIL PROTECTED] [EMAIL PROTECTED]:


Hi, all

I have encrypted the file with the manpage example (blowfish), and  
then

decrypt it. It will be fine if I try some small files, however, when I
test some big files (e.g.: 100M), the decryption will not work.

Is there anybody can suggest me an available way to do big file
encryption and decryption with symmetric algorithm?

Any comments/suggestions will be welcome!

Best regards
Gong


== 
=
The privileged confidential information contained in this email is  
intended for use only by the addressees as indicated by the  
original sender of this email. If you are not the addressee  
indicated in this email or are not responsible for delivery of the  
email to such  a person, please kindly reply to the sender  
indicating this fact and delete all copies of it from your computer  
and network server immediately. Your cooperation is highly  
appreciated. It is advised that any unauthorized use of  
confidential information of Winbond is strictly prohibited; and any  
information in this email irrelevant to the official business of  
Winbond shall be deemed as neither given nor endorsed by Winbond.

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]



__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Encrypt the big file with symmetric algorithm

2007-05-16 Thread Chaz.

[EMAIL PROTECTED] wrote:

Hi, all

I have encrypted the file with the manpage example (blowfish), and then
decrypt it. It will be fine if I try some small files, however, when I
test some big files (e.g.: 100M), the decryption will not work.

Is there anybody can suggest me an available way to do big file
encryption and decryption with symmetric algorithm?

Any comments/suggestions will be welcome!

Best regards 
Gong



===
The privileged confidential information contained in this email is intended for 
use only by the addressees as indicated by the original sender of this email. 
If you are not the addressee indicated in this email or are not responsible for 
delivery of the email to such  a person, please kindly reply to the sender 
indicating this fact and delete all copies of it from your computer and network 
server immediately. Your cooperation is highly appreciated. It is advised that 
any unauthorized use of confidential information of Winbond is strictly 
prohibited; and any information in this email irrelevant to the official 
business of Winbond shall be deemed as neither given nor endorsed by Winbond.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


This should do what you want. Any questions just ask.

Chuck Wegrzyn


/** \file blowfish.c
 *  \brief Provides encryption/decryption services for the Blowfish algorithm.
 */

#include stdio.h
#include stdlib.h
#include unistd.h
#include sys/types.h
#include sys/stat.h
#include sys/file.h   // flock
#include fcntl.h
#include string.h
#include errno.h

#include openssl/evp.h
#include openssl/err.h

#include portable.h
#include exception.h
#include dir.h
#include ltscrypto.h
#include logger.h

#include crypto.h

extern Exc_t   enomore;
extern Exc_t   ecrypto;


#ifndef CRYPT_BUFSIZE
#define CRYPT_BUFSIZE(1024)
#endif

typedef struct {
EVP_CIPHER_CTX ctx;
  t_key_iv kiv;
   int first;
   } t_CONTEXT,*p_CONTEXT;


static void EncryptData(const EVP_CIPHER *cipher,int inFid, int outFid, char 
*key, char *iv, const char *pTitle)
 THROWS(efile)
 THROWS(ecrypto)
{
unsigned char buffer[CRYPT_BUFSIZE],obuffer[2*CRYPT_BUFSIZE];
int oLen,iLen;
// Setup the crypto context...
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(ctx);
EVP_EncryptInit_ex(ctx,cipher, NULL, key,iv);

// Until we exhaust input file data...
for( ;1; )
{
// Set the buffer to zeros...
memset(buffer,0,sizeof(buffer));

// Read in some data. If it comes back 0, we are done.
iLen = read(inFid,buffer,sizeof(buffer));
if( 0 == iLen ) break;
if( -1 == iLen ) { eraise2(efile, ((%s) : File read error 
(%s),pTitle,strerror(errno))); }

// Encrypt it now.
if( 0 == EVP_EncryptUpdate(ctx,obuffer,oLen,buffer,iLen) )
   {
unsigned long int x = ERR_get_error();
char szBuff[256];
ERR_error_string_n(x,szBuff,sizeof(szBuff));
eraise2(ecrypto,(szBuff));
   }
iLen = write(outFid,obuffer,oLen);
if( -1 == iLen ) { eraise2(efile, ((%s) : File write error 
(%s),pTitle,strerror(errno))); }
}

// Finish up taking whatever is left in the encryption system and writing 
it out...
if( 0 == EVP_EncryptFinal_ex(ctx,obuffer,oLen) )
{
unsigned long int x = ERR_get_error();
char szBuff[256];
ERR_error_string_n(x,szBuff,sizeof(szBuff));
eraise2(ecrypto,(szBuff));
}
iLen = write(outFid,obuffer,oLen);
if( -1 == iLen ) { eraise2(efile, ((%s) : File write error 
(%s),pTitle,strerror(errno))); }

// Cleanup..
EVP_CIPHER_CTX_cleanup(ctx);
}


static void DecryptData(const EVP_CIPHER *cipher,int inFid, int outFid, char 
*key, char *iv, const char *pTitle)
{
unsigned char buffer[CRYPT_BUFSIZE],obuffer[2*CRYPT_BUFSIZE];
int oLen,iLen;
// Initialize things.
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(ctx);
EVP_DecryptInit_ex(ctx, cipher, NULL, key, iv);

// PRocess the file until we are done with it
for( ;1; )
{
// Get some file input...
memset(buffer,0,sizeof(buffer));
iLen = read(inFid,buffer,sizeof(buffer));

// If there is no more, we are done.
if( 0 == iLen ) break;
if( -1 == iLen ) { eraise2(efile, ((%s) : File read error 
(%s),pTitle,strerror(errno))); }

// Decrypt it.
if( 0 ==