Lost data at the buffer during symmetric block encryption

2001-10-09 Thread Jordan C N Chong

Dear All,

I am sorry to bother you...I need your help...

Have you faced such problem - loose some data at the end of a buffer...

The code is like this
I want to encrypt a file 1024 blocks by 1024 blocks
and at the final block which is not 1024 blocks will do the final management
like follows:


unsigned char inbuf[1024], outbuf[1024];

// Obtain the file size
fseek(fin, 0, SEEK_END);
size = ftell(fin);
rewind(fin);

buffer = (char *)malloc(size);
output = (char *)malloc(size);
int shift = 0;
int kBufferSize = 1024;

fread(buffer, 1, size, fin);
if (buffer == NULL) exit(2);

// THE PROBLEM STARTS HERE, TAKE 1024 BYTES SLIDINGLY
while (shift  size) {
inlen = 0;
for (int i=0; ikBufferSize; i++) {
if (i+shift  size){
inbuf[i] = (unsigned)buffer[i+shift];
inlen++;
}
}
if (!EVP_DecryptUpdate(ctx, outbuf, outlen, inbuf, inlen)) {
printf(ERROR 1);
exit(-1);
}
for (int j=0; joutlen; j++)
if (j+shift  size) {
output[j+shift] = (char)outbuf[j];
printf(%c, output[j+shift]); //PRINT 1
}
shift+=kBufferSize;
}
if (!EVP_DecryptFinal(ctx, outbuf, outlen)) {
printf(ERROR 2);
exit(-1);
}
for (int k=0; koutlen; k++) {
output[k+shift] = (char)outbuf[k];
printf(%c, output[k+shift]); //PRINT 2
}
printf(\nsize:%d\n, size); // PRINT 3
printf(output size:%d\n, strlen(output)); // PRINT 4
for (int x=0; xsize; x++) {
printf(%c, output[x]); // PRINT 5
}
fwrite(output, 1, size, fout);

===

You don't have to look into the codes. When I try to deal with a file
test.txt which has a sentence This is a test.. The problem is at the end
of the code, it prints out:

This is a test. //THIS IS THE CORRECT DATA IN OUTPUT BUFFER (PRINT 1  2)
size: 16 //THIS IS THE SIZE OF THE FILE WHICHI IS CORRECT TOO (PRINT 3)
output size: 8 //NOW I DON'T UNDERSTAND WHY HERE... (PRINT 4)
This is //THERE IS SOME DATA MISSED IN THE OUTPUT BUFFER (PRINT 5)

Please help me if you have the time. I don't know why there is some data
lost in the buffer...

Thousand thanks. Wish you all the best.


Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



Encrypt and decrypt a big char array

2001-10-03 Thread Jordan C N Chong

Dear all,

Sorry to bother you. I wish to encrypt a big chunk of char array (like
3000bytes) using a symmetric key (for example Blowfish 16 bytes)... However
I am not sure how to do that...

Could you please help me out?? I really need your expertise for this issue.
Thank you very much.

Wish you all the best


Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



Problems with BIO_s_mem and BIO_s_file

2001-09-24 Thread Jordan C N Chong

Dear all,

I have an encrypted char *, to be decrypted using the private key read from
the PKCS12 protection file (which is done!!). Now the problem lies into the
BIO_s_mem and BIO_s_file (the encrypted char * is Base64 encoded)

I have run the two tests:
1. Store the char * into a file called temp.tmp, and write the following
code:
/* START **/
b64 = BIO_new(BIO_f_base64());
bio2 = BIO_new_file(temp.tmp, rb);
bio2 = BIO_push(b64, bio2);

if ((inlen2 = BIO_read(bio2, ecryptedData, 128)) = 0) {
printf(error 1);
exit(-1);
}
encryptedData[128] = '\0';
// decryption with the private key
if (EVP_PKEY_decrypt(decryptedData, encryptedData, 128, privKey) == -1) {
printf(error 2);
exit(-1);
}
/ END */
IT WORKS FINE!

2. Then I test the following code, by reading in the char * directly into a
BIO_s_mem:
/* START **/
b64 = BIO_new(BIO_f_base64());
bio2 = BIO_new(BIO_s_mem());
BIO_write(bio2, data, 128);
bio2 = BIO_push(b64, bio2);
if ((inlen2 = BIO_read(b64, encryptedData, 128)) = 0) {
printf(error 1);
exit(-1);
}
encryptedData[128] = '\0';
// decryption with the private key
if (EVP_PKEY_decrypt(decryptedData, encryptedData, 128, privKey) == -1) {
printf(error 2);
exit(-1);
}
/ END */
THE MESSAGE error 2 is printed.

What is the difference (of course there must be a difference, but I wish you
could help me)? Is there something wrong with the code 2? When I printed out
the encryptedData array as a string (printf(%s\n, encryptedData)), they
look the same. Please help. Thousand thanks.



Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



RE: How to load a P12 certificate?

2001-09-19 Thread Jordan C N Chong
Title: ??: How to load a P12 certificate?



Thanks 
to you, YongYue,
HoweverI am not sure what do you mean by 
"Initialize lib..."
Could 
you please be more specific? I am really sorry to bother you 
again.

Thanks 
again for your help.

Best 
regards,Jordan Cheun Ngen, 
ChongINF-4067 Universiteit TwentePostbus 2177500 AE EnschedeThe 
NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 53 
4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of YONG.YUESent: Tuesday, September 18, 2001 3:12 
  AMTo: '[EMAIL PROTECTED]'Subject: ??: How to 
  load a P12 certificate?
  
  i think 
  u should initialize the openssl lib first..
  
--: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED]] Jordan C N 
Chong: 2001917 21:04: 
[EMAIL PROTECTED]: RE: How to load a P12 
certificate?
Dear YongYue

I 
am sorry to bother you again. Thousand thanks for your help indeed. After 
testing your code, sadly it doesn't work. I have done two tests on the 
codes:

1. 
Put nothing (or some wrong password) at the password field during 
parsing
2. 
Test whether the m_pcert and m_pkey are NULL

the first one doesn't do anything at all to the 
codes.
the second one, well I am not sure, m_pkey is 
NULL.

I 
do need your help. Thousand thanks.

All the best.

Best 
regards,Jordan Cheun 
Ngen, ChongINF-4067 Universiteit TwentePostbus 2177500 AE 
EnschedeThe NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 
53 4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]]On Behalf Of 
  YONG.YUESent: Thursday, September 13, 2001 10:54 
  AMTo: '[EMAIL PROTECTED]'Subject: ??: How to 
  load a P12 certificate?
  just refer to this code 
   // new bio mem 
  area  m_biopkcs12 = BIO_new_file(szpkcsfile, "rb"); 
   if(m_biopkcs12 
  == NULL)  {  
   bError = 
  false;  
   goto 
  finish;  }  // parse pkcs12 
   m_pkcs12 = 
  d2i_PKCS12_bio(m_biopkcs12, NULL); 
   if(m_pkcs12 == 
  NULL)  {  
   bError = 
  false;  
   goto 
  finish;  }  //  nLen = PKCS12_parse(m_pkcs12, szpkcspasswd, m_pkey, 
  m_pcert, NULL);  
  if(nLen  0) 
   { 
   
   bError = 
  false;  
   goto 
  finish;  }  //  BIO_free_all(m_biopkcs12); 
   return 
  true; 
   Look at PKCS12_Parse(). You provide it a buffer 
  with the  PKCS#12 and the password for the 
  private key, and it  returns an X509 object 
  and a EVP_PKEY object. 
  Could you please tell me, which document should I look to 
  regards this? Thanks again for your help. Wish you 
  all the best. 
  __ 
  OpenSSL 
  Project 
  http://www.openssl.org User 
  Support Mailing 
  List 
  [EMAIL PROTECTED] Automated List 
  Manager 
  [EMAIL PROTECTED] 



Padding?

2001-09-19 Thread Jordan C N Chong

Dear all,

Sorry to bother you all.

I am doing symmetric encryption and decryption. For encryption, I am using
Java class libraries from IAIK. For decryption, I wish to use OpenSSL
cryptography library.

I am using Blowfish algorithm. For encryption, using CBC mode and PKCS5
padding. Therefore, I wish to know whether OpenSSL cryptography provides
standard padding service? From that, IV may (I reckon) be avoided... (If I
am wrong, could you please correct me?). Do you have any suggestions? Thank
you very much. wish you all the best.


Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



Padding for symmetric algorithm

2001-09-19 Thread Jordan C N Chong

Dear all,

Sorry to bother you all. If you have received this email before, I am sorry
to send it again because my mail server has some problem.

I wish to do symmetric encryption and decryption. For encryption, I am
using Java crypthography library from IAIK. For decryption, I am using
OpenSSL C++ cryptography library.

At encryption, I am using blowfish, CBC mode, and PKCS5 padding. Does
OpenSSL cryptography library support PKCS standard padding, so that IV is
not needed (please correct me if I am wrong about this statement).

And, I have a char * of blowfish key which is encoded from the key
generated by using Java cryptography library. Is there a routine to convert
this char * into the blowfish key using OpenSSL?

Your help is highly appreciated. Thousand thanks. Wish you all the best.

Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



Padding?

2001-09-19 Thread Jordan C N Chong

Dear all,

Sorry to bother.

Does symmetric algorithm provided by OpenSSL cryptography library support
padding? Like PKCS5 Padding for Blowfish encryption and decryption (for IV).

Thanks.


Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



Confused with the cryptography library.

2001-09-19 Thread Jordan C N Chong

Dear all,

I am using Openssl 0.9.6 cryptograhy library.

According to http://www.openssl.org/docs/crypto/EVP_EncryptInit.html
there is a method EVP_CIPHER_CTX_set_padding under openssl/evp.h
However I tried to find it, I couldn't find it.
Is it because this is the incorrect version, or there is other reasons?


Please help. Thank you very much.

Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



RE: How to load a P12 certificate?

2001-09-17 Thread Jordan C N Chong
Title: ??: How to load a P12 certificate?



Dear 
YongYue

I am 
sorry to bother you again. Thousand thanks for your help indeed. After testing 
your code, sadly it doesn't work. I have done two tests on the 
codes:

1. Put 
nothing (or some wrong password) at the password field during 
parsing
2. 
Test whether the m_pcert and m_pkey are NULL

the 
first one doesn't do anything at all to the codes.
the 
second one, well I am not sure, m_pkey is NULL.

I do 
need your help. Thousand thanks.

All 
the best.

Best 
regards,Jordan Cheun Ngen, 
ChongINF-4067 Universiteit TwentePostbus 2177500 AE EnschedeThe 
NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 53 
4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of YONG.YUESent: Thursday, September 13, 2001 10:54 
  AMTo: '[EMAIL PROTECTED]'Subject: ??: How to 
  load a P12 certificate?
  just refer to this code 
   // new bio mem 
  area  m_biopkcs12 = BIO_new_file(szpkcsfile, "rb"); 
   if(m_biopkcs12 == 
  NULL)  {  
   bError = false; 
   
   goto finish; 
   } 
   // parse 
  pkcs12  m_pkcs12 = d2i_PKCS12_bio(m_biopkcs12, NULL); 
   if(m_pkcs12 == 
  NULL)  {  
   bError = false; 
   
   goto finish; 
   } 
   // 
   nLen = 
  PKCS12_parse(m_pkcs12, szpkcspasswd, m_pkey, m_pcert, NULL); 
   if(nLen  
  0)  { 
   
   bError = false; 
   
   goto finish; 
   } 
   // 
   BIO_free_all(m_biopkcs12); 
   return 
  true; 
   Look at PKCS12_Parse(). You provide it a buffer 
  with the  PKCS#12 and the password for the private 
  key, and it  returns an X509 object and a EVP_PKEY 
  object. 
  Could you please tell me, which document should I look to 
  regards this? Thanks again for your help. Wish you all 
  the best. 
  __ 
  OpenSSL 
  Project 
  http://www.openssl.org User Support 
  Mailing 
  List 
  [EMAIL PROTECTED] Automated List 
  Manager 
  [EMAIL PROTECTED] 


RE: How to load a P12 certificate?

2001-09-14 Thread Jordan C N Chong
Title: ??: How to load a P12 certificate?



Dear 
Yong Yue

It is 
you again that helps me :D Thousand thanks. 

But 
could you please direct me to a documentation about this 
codes?

So 
that I could understand it more :)

Thousand thanks again for your 
kindness

Wish 
you all the best


Best 
regards,Jordan Cheun Ngen, 
ChongINF-4067 Universiteit TwentePostbus 2177500 AE EnschedeThe 
NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 53 
4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of YONG.YUESent: Thursday, September 13, 2001 10:54 
  AMTo: '[EMAIL PROTECTED]'Subject: ??: How to 
  load a P12 certificate?
  just refer to this code 
   // new bio mem 
  area  m_biopkcs12 = BIO_new_file(szpkcsfile, "rb"); 
   if(m_biopkcs12 == 
  NULL)  {  
   bError = false; 
   
   goto finish; 
   } 
   // parse 
  pkcs12  m_pkcs12 = d2i_PKCS12_bio(m_biopkcs12, NULL); 
   if(m_pkcs12 == 
  NULL)  {  
   bError = false; 
   
   goto finish; 
   } 
   // 
   nLen = 
  PKCS12_parse(m_pkcs12, szpkcspasswd, m_pkey, m_pcert, NULL); 
   if(nLen  
  0)  { 
   
   bError = false; 
   
   goto finish; 
   } 
   // 
   BIO_free_all(m_biopkcs12); 
   return 
  true; 
   Look at PKCS12_Parse(). You provide it a buffer 
  with the  PKCS#12 and the password for the private 
  key, and it  returns an X509 object and a EVP_PKEY 
  object. 
  Could you please tell me, which document should I look to 
  regards this? Thanks again for your help. Wish you all 
  the best. 
  __ 
  OpenSSL 
  Project 
  http://www.openssl.org User Support 
  Mailing 
  List 
  [EMAIL PROTECTED] Automated List 
  Manager 
  [EMAIL PROTECTED] 


Encryption and Decryption (as/symmetric)

2001-09-14 Thread Jordan C N Chong

Dear all,

I am terribly sorry for keep spamming you with these questions. I am too
fresh and too new to OpenSSL cryptography, and wishing desperately for some
documents (I have looked at the SSLeay Documentation) or some information on
this useful technology.

I really appreciate your help, advices and time for solving my problems.
Till now, most of my problems are solved because of your valuable effort.
Now, I have several questions which I guess I could solve myself (if I am
really good in OpenSSL technology).

1. I get bothered by the unsigned char * and char *. I have to decrypt a
symmetric key with a RSA private key. Now, the symmetric key is encoded by
Base64 form. It basically is char *. Thanks to Yue's help, I manage to
decode the char * using BIO routines. Now, I am not sure I could extract the
private key from P12, and I also not sure how to decrypt the char * of key
using that private key... ... I tried to use EVP routine (EVP_PKEY_decrypt)
but as I said the unsigned thing really bothers me, and the whole
application crashed when I run it... PLEASE HELP ME WITH SOME ADVICES OR
HINTS...

2. Symmetric decryption with Blowfish. Even if the number 1 is succeded. How
to load the char * (or unsigned char *) of the key for the Blowfish
decryption?? PLEASE HELP ME WITH SOME HINTS...

Thousand thanks for everything. For at least reading this long email. And
sorry to bother you again and again. Wish you all the best.


Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



RE: How to load a P12 certificate?

2001-09-13 Thread Jordan C N Chong


Thanks to you Dale :)

 Look at PKCS12_Parse().  You provide it a buffer with the
 PKCS#12 and the password for the private key, and it
 returns an X509 object and a EVP_PKEY object.

Could you please tell me, which document should I look to regards this?
Thanks again for your help. Wish you all the best.

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



Please Help: Crypto library with Visual C++

2001-09-10 Thread Jordan C N Chong

Dear All,


Thousand thanks for your help. I really appreciate that. Your help really
means a lot to me...

Now, the problem is about the VC setting,

I am not sure how to set the directory settings for the project

For example, I copied all the files from the directory crypto in the
openssl-x-x to another directory, and then rename it to openssl. I
include the header file of envelope evp/evp.h. But when I compile the
file, the compiler complains it couldn't find the file
openssl/opensslconf.h (which exists in the crypto directory).

I hope you could understand my problem. So... I am really confused on how
to set up the directory. I don't want to modify all the header files. Is
there alternative ways? Please help. Thousand thanks. Wish you all the best.



Best regards,

Jordan Cheun Ngen, Chong
INF-4067 Universiteit Twente
Postbus 217
7500 AE Enschede
The Netherlands

Distributed and Embedded Systems (DIES)

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



RE: Please Help: Crypto library with Visual C++

2001-09-10 Thread Jordan C N Chong
Title: ??: Please Help: Crypto library with Visual C++



thousand thanks for your help :D

it 
helps a lot and it works fine now...

Now, 
pls. one more thing,

I 
tried to decode a Base64 encoded string into 
the 
string is (for example) 
:KljL0/zpzt8Y/UtenpqyMPt3JjQTFV5uofM349JXCY1z2i08XKzTW7LlpgnPDLh48Trbq6b/TErJ3UwFvbo8TOf8l4Xnp9yI6RtTWJlVZzJ5+AnY7lKLThSq8fgpVqwnJGVjfIHev6AI9qKHT+8vhN9tTacdU6WkZ6oYiOTb0jE=

I am 
not sure how

Do you 
know where I could some example codes, or perhaps some references on this 
stuff?
very 
struggling indeed :)

Thanks 
again for everything.

Best 
regards,Jordan Cheun Ngen, 
ChongINF-4067 Universiteit TwentePostbus 2177500 AE EnschedeThe 
NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 53 
4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of YONG.YUESent: Monday, September 10, 2001 11:17 
  AMTo: '[EMAIL PROTECTED]'Subject: ??: Please 
  Help: Crypto library with Visual C++
  i think all necessary files for your application is as 
  follows: 
  openssl-0.9.6a/out32dll/ : ssleay32.dll  
  libeay32.dll  
   
   ssleay32.lib  
  libeay32.rls 
  openssl-0.9.6a/inc32/openssl - this directory contains all 
  head files needed 
  you can do this by two means first : 
  you copy the inc32/openssl to the vc include directory such as 
  D:\Program Files\Microsoft Visual 
  Studio\VC98\INCLUDE\openssl ... vc++ can find this 
  head file automaticly. this one seems much more easy 
  ..haha 
  second ..you make a directory called include parallel to your 
  project diectory.. copy openssl head files to this 
  directory .. then in your project setting: c++ 
  /preprocessor /additonal include directories ... add : ..\include 
  then all ok .. have a good time 
  
   
  
  -ÔʼÓʼþ- ·¢¼þÈË: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]´ú±í 
  Jordan C N Chong ·¢ËÍʱ¼ä: 2001Äê9ÔÂ10ÈÕ 15:43 
  ÊÕ¼þÈË: openss-user Ö÷Ìâ: Please 
  Help: Crypto library with Visual C++ 
  Dear All, 
   Thousand thanks for 
  your help. I really appreciate that. Your help really means a lot to me... 
   Now, the problem is 
  about the VC setting, 
   I am not sure how 
  to set the directory settings for the project 
   For example, I 
  copied all the files from the directory "crypto" in the "openssl-x-x" to another directory, and then rename it to "openssl". 
  I include the header file of envelope "evp/evp.h". But 
  when I compile the file, the compiler complains it 
  couldn't find the file "openssl/opensslconf.h" (which 
  exists in the "crypto" directory). 
   I hope you could 
  understand my problem. So... I am really confused on how to set up the directory. I don't want to modify all the header files. 
  Is there alternative ways? Please help. Thousand 
  thanks. Wish you all the best. 
  Best regards,  Jordan Cheun Ngen, Chong INF-4067 Universiteit 
  Twente Postbus 217 7500 AE 
  Enschede The Netherlands 
  Distributed and Embedded Systems (DIES)  Office Phone: +31 53 4894655 Web site: http://www.cs.utwente.nl/~chong Email Add.: [EMAIL PROTECTED]  
  __ 
  OpenSSL 
  Project 
  http://www.openssl.org User Support 
  Mailing 
  List 
  [EMAIL PROTECTED] Automated List 
  Manager 
  [EMAIL PROTECTED] 


RE: Please Help: Crypto library with Visual C++

2001-09-10 Thread Jordan C N Chong
Title: ??: Please Help: Crypto library with Visual C++



Dear 
Yong Yue

I am 
sorry to bother you again. The description is clear enough on the URL you gave 
me.
However, I looked at the BIO explanation on http://www.columbia.edu/~ariel/ssleay/bio.html
I am 
not sure how to read in some data from a file to the BIO 
filter/sink/source

Is 
there any example for this purpose?

I am 
really really terribly sorry to bother you. Thanks for your help. Wish you all 
the best.

Best 
regards,Jordan Cheun Ngen, 
ChongINF-4067 Universiteit TwentePostbus 2177500 AE EnschedeThe 
NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 53 
4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of YONG.YUESent: Monday, September 10, 2001 12:19 
  PMTo: '[EMAIL PROTECTED]'Subject: ??: Please 
  Help: Crypto library with Visual C++
  u can 
  follow this link: http://www.openssl.org/docs/crypto/BIO_f_base64.html#
  
-原始邮件-发件人: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED]]代表 Jordan C N 
Chong发送时间: 2001年9月10日 18:04收件人: 
[EMAIL PROTECTED]主题: RE: Please Help: Crypto library with 
Visual C++
thousand thanks for your help 
:D

it 
helps a lot and it works fine now...

Now, pls. one more thing,

I 
tried to decode a Base64 encoded string into 
the string is (for example) 
:KljL0/zpzt8Y/UtenpqyMPt3JjQTFV5uofM349JXCY1z2i08XKzTW7LlpgnPDLh48Trbq6b/TErJ3UwFvbo8TOf8l4Xnp9yI6RtTWJlVZzJ5+AnY7lKLThSq8fgpVqwnJGVjfIHev6AI9qKHT+8vhN9tTacdU6WkZ6oYiOTb0jE=

I 
am not sure how

Do 
you know where I could some example codes, or perhaps some references on 
this stuff?
very struggling indeed :)

Thanks again for everything.

Best 
regards,Jordan Cheun 
Ngen, ChongINF-4067 Universiteit TwentePostbus 2177500 AE 
EnschedeThe NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 
53 4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]]On Behalf Of 
  YONG.YUESent: Monday, September 10, 2001 11:17 
  AMTo: '[EMAIL PROTECTED]'Subject: ??: Please 
  Help: Crypto library with Visual C++
  i think all necessary files for your application is as 
  follows: 
  openssl-0.9.6a/out32dll/ : ssleay32.dll  
  libeay32.dll  
   
   ssleay32.lib  
  libeay32.rls 
  openssl-0.9.6a/inc32/openssl - this directory contains all 
  head files needed 
  you can do this by two means first 
  : you copy the inc32/openssl to the vc include directory such as 
  D:\Program Files\Microsoft Visual 
  Studio\VC98\INCLUDE\openssl ... vc++ can find this 
  head file automaticly. this one seems much more 
  easy ..haha 
  second ..you make a directory called include parallel to 
  your project diectory.. copy openssl head files to 
  this directory .. then in your project 
  setting: c++ /preprocessor /additonal include directories ... add : 
  ..\include 
  then all ok .. have a good 
  time 
   
  
  -ÔʼÓʼþ- ·¢¼þÈË: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]´ú±í 
  Jordan C N Chong ·¢ËÍʱ¼ä: 2001Äê9ÔÂ10ÈÕ 
  15:43 ÊÕ¼þÈË: openss-user Ö÷Ìâ: Please Help: Crypto library with Visual C++ 
  Dear All, 
   Thousand thanks 
  for your help. I really appreciate that. Your help really means a lot to me... 
   Now, the 
  problem is about the VC setting, 
   I am not sure 
  how to set the directory settings for the project 
   For example, I 
  copied all the files from the directory "crypto" in the "openssl-x-x" to another directory, and then rename it to 
  "openssl". I include the header file of envelope 
  "evp/evp.h". But when I compile the file, the 
  compiler complains it couldn't find the file "openssl/opensslconf.h" (which exists in the "crypto" 
  directory). 
   I hope you 
  could understand my problem. So... I am really confused on how 
  to set up the directory. I don't want to modify all the 
  header files. Is there alternative ways? Please 
  help. Thousand thanks. Wish you all the best. 
  Best regards,  Jordan Cheun Ngen, Chong INF-4067 
  Universiteit Twente Postbus 217 7500 AE Enschede The Netherlands 

  Distributed and Embedded Systems (DIES) 

RE: Please Help: BIO!!

2001-09-10 Thread Jordan C N Chong
Title: ??: Please Help: Crypto library with Visual C++



Hi,

Thanks 
for your reply. I have tried, still the memory leak problem happens 
:)
and 
the whole application crashes

my 
code is like this:

BIO *bio, *b64;BIO 
*bio_out;char inbuf[128];int 
inlen;b64 = BIO_new(BIO_f_base64());bio = 
BIO_new_file("content.key", "rb"); bio_out = BIO_new_fp(stdout, 
BIO_NOCLOSE);bio = BIO_push(b64, bio);while ((inlen = 
BIO_read(bio, inbuf, 128))  0) {BIO_write(bio_out, inbuf, 
inlen);}

BIO_free_all(bio);

what I 
wish to do is, read the data from the file content.key 
and 
then decode the data 
and 
then convert the decoded data in to a char * (or perhaps to another new 
file)
but 
here what i do is just print out the decoded data :)

i am 
sorry to bother you that much.

pls 
forgive
and 
pls help if you have the time :D

thousand thanks. Wish you all the 
best.

Best 
regards,Jordan Cheun Ngen, 
ChongINF-4067 Universiteit TwentePostbus 2177500 AE EnschedeThe 
NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 53 
4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of ??Sent: Monday, September 10, 2001 1:24 
  PMTo: '[EMAIL PROTECTED]'Subject: ??: Please 
  Help: Crypto library with Visual C++
  oh 
  nothing do not be nervous
  i think 
  if you want to read data from a file 
  first 
  you must construct a 
  
  BIO * mbio = BIO_new_file(filename , "rb") object 
  
  then build another BIO* b64 =BIO_new(BIO_f_base64()); 
  then mbio = BIO_push(b64, 
  mbio); 
  
  all ok 
  ...
  read data from 
  
  while((inlen = 
  BIO_read(mbio, inbuf, strlen(message)))  0)
  {
  do as you 
  wish
  }// remember free all bio resource BIO_free_all(bio);
can this solve your problem?


RE: Please Help: BIO!!

2001-09-10 Thread Jordan C N Chong
Title: ??: Please Help: Crypto library with Visual C++



HI :D 
Sorry to bother you again.


I 
think I have found the reason :)
it is 
because the Project setting is incorrect (thanks for your hints 
indeed)

I have 
to set the Code Generation (under tag C/C++), the "Use run-time library" to 
"Multithreaded DLL" :D

All 
the best.

Best 
regards,Jordan Cheun Ngen, 
ChongINF-4067 Universiteit TwentePostbus 2177500 AE EnschedeThe 
NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 53 
4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of ??Sent: Monday, September 10, 2001 1:48 
  PMTo: '[EMAIL PROTECTED]'Subject: ??: Please 
  Help: BIO!!
  
  oh when application crash .. it normally beacause link mfc lib 
  problem
  you may try use mfc in shared dll or mfc instatic 
  dll
  it may ok..
  as for memory leak ..
  
  begin ..
  OpenSSL_add_all_algorithms();SSL_load_error_strings();
  
  your code...
  End:
  
  ERR_free_strings();EVP_cleanup();
  
  see u later...:)
  
-原始邮件-发件人: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED]]代表 Jordan C N 
Chong发送时间: 2001年9月10日 19:43收件人: 
[EMAIL PROTECTED]主题: RE: Please Help: 
BIO!!
Hi,

Thanks for your reply. I have tried, still the 
memory leak problem happens :)
and the whole application 
crashes

my 
code is like this:

BIO *bio, *b64;BIO 
*bio_out;char inbuf[128];int 
inlen;b64 = BIO_new(BIO_f_base64());bio 
= BIO_new_file("content.key", "rb"); bio_out = BIO_new_fp(stdout, 
BIO_NOCLOSE);bio = BIO_push(b64, bio);while 
((inlen = BIO_read(bio, inbuf, 128))  0) 
{BIO_write(bio_out, inbuf, 
inlen);}

BIO_free_all(bio);

what I wish to do is, read the data from the file 
content.key 
and then decode the data 
and then convert the decoded data in to a char * 
(or perhaps to another new file)
but here what i do is just print out the decoded 
data :)

i 
am sorry to bother you that much.

pls forgive
and pls help if you have the time 
:D

thousand thanks. Wish you all the 
best.

Best 
regards,Jordan Cheun 
Ngen, ChongINF-4067 Universiteit TwentePostbus 2177500 AE 
EnschedeThe NetherlandsDistributed and Embedded Systems 
(DIES)Office Phone: +31 
53 4894655Web site: http://www.cs.utwente.nl/~chongEmail Add.: 
[EMAIL PROTECTED]

  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]]On Behalf Of 
  ??Sent: Monday, September 10, 2001 1:24 PMTo: 
  '[EMAIL PROTECTED]'Subject: ??: Please Help: Crypto 
  library with Visual C++
  oh 
  nothing do not be nervous
  i 
  think if you want to read data from a file 
  first you must construct a 
  
  BIO * mbio = 
  BIO_new_file(filename , "rb") object 
  then build another BIO* b64 
  =BIO_new(BIO_f_base64()); 
  
  then mbio = 
  BIO_push(b64, mbio); 
  
  all ok 
  ...
  read data from 
  
  while((inlen = 
  BIO_read(mbio, inbuf, strlen(message)))  0)
  {
  do as you 
  wish
  }// remember free all bio resource BIO_free_all(bio);
can this solve your problem?


Use OpenSSL Crypto. How?

2001-09-05 Thread Jordan C N Chong

Dear all,

Please help.

I wish to use OpenSSL cryptography for developing an application. However I
am not sure how to do that? Is there any reference, example, or perhaps
tutorial for using the OpenSSL crypto? Please help.

Thanks.



Best regards,

Jordan Cheun Ngen, Chong
Room 4067
Distributed and Embeded Systems Group
Centre for Telematics and Information Technology
University of Twente
Faculty Informatica
7522 NB Enschede
The Netherlands

Office Phone: +31 53 4894655
Web site: http://www.cs.utwente.nl/~chong
Email Add.: [EMAIL PROTECTED]


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



RE: Please Help: Crypto

2001-09-05 Thread Jordan C N Chong

Dear Dirk,

 Have a look at http://www.iconsinc.com/~agray/ossldev/nt and pick the
 workspace for the version of OpenSSL you want to use (you'll still need to
 download the src tarball of OpenSSLvx.y.z).

 CU,
 Dirk

Thanks for your reply. I don't understand here.

All I wish to do is to use the OpenSSL cryptography library... but not
OpenSSL.. Although I have already installed the OpenSSL with Apache server
on my machine...
1. to do enc/decryption
2. signature generation and verification
3. certificate management

However I wish to know whether there is a specific direction on achieving
that... like:
1. how to use the provided OpenSSL crypto API?
2. any settings on VC++ 6.0 for that?
3. any library (.LIB) needed?
etc.

Please help.

Thanks.

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