Re: proxy certificate support in openssl 0.9.8
In message <[EMAIL PROTECTED]> on Tue, 22 Mar 2005 15:14:11 -0800, Matthew Rodriguez DSD staff <[EMAIL PROTECTED]> said: MKRodriguez> Specifically else if condition was true. MKRodriguez> ku_reject(issuer, KU_KEY_CERT_SIGN) MKRodriguez> I think this means that my EE cert is not allowed to sign MKRodriguez> for other certs. Is that correct? MKRodriguez> MKRodriguez> if(subject->ex_flags & EXFLAG_PROXY) MKRodriguez> { MKRodriguez> if(ku_reject(issuer, KU_DIGITAL_SIGNATURE)) MKRodriguez> return X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE; MKRodriguez> } MKRodriguez> else if(ku_reject(issuer, KU_KEY_CERT_SIGN)) MKRodriguez> return X509_V_ERR_KEYUSAGE_NO_CERTSIGN; Nope. As you can see, if the subject certificate is a proxy certificate (the flag EXFLAG_PROXY is set), it will reject if the key usage doesn't contain digitalSignature. However, according to what you've said, your EE certificate does have that set. If you actually get to the ku_reject(issuer, KU_KEY_CERT_SIGN), it means your proxy certificate hasn't been identified as a proxy certificate. The ONLY condition to get that flag set is that the proxy certificate contains a proxyCertInfo extension, which effectively identifies it as a proxy certificate. Can you send me your proxy certificate and EE certificate? NOT THE KEYS, please. Cheers, Richard - Please consider sponsoring my work on free software. See http://www.free.lp.se/sponsoring.html for details. -- Richard Levitte [EMAIL PROTECTED] http://richard.levitte.org/ "When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." -- C.S. Lewis __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: proxy certificate support in openssl 0.9.8
Matthew Rodriguez DSD staff wrote: Richard Levitte - VMS Whacker wrote: In message <[EMAIL PROTECTED]> on Tue, 15 Mar 2005 14:36:57 -0800, Matt Rodriguez <[EMAIL PROTECTED]> said: MKRodriguez> I've looking at the tests in the snapshots for 0.9.8. I MKRodriguez> am trying to figure out what functionality regarding MKRodriguez> proxy certificates has been implemented. Most importantly: - verification, as a change in the functions used by X509_verify_cert() - parsing of proxy certificate extensions in a configuration file. - implementation of internal ASN.1 structures for ProxyCertInfoExtensions and ProxyPolicy. MKRodriguez> Here are 2 things that I am looking for: MKRodriguez> MKRodriguez> 1) I need to be able to do a handshake using proxy MKRodriguez>certificates for client and server authentication. If you don't care about the rights assigned with the policy extensions, you can do it by just setting the certificate to use and the whole chain properly. A "catch" is the the whole chain, CA root cert, CA intermediate certs, EE cert and intermediate proxy certs are view as the issuing chain, and should be part of whatever you use as your CA certificate bundle. Reflecting on the problem a little more, I think I see what you mean by the catch. My EE cert does not have the ability to sign certificates like my one of my CA certs is able to do. But openssl is treating my EE like it is a CA. Here is the KeyUsage on my EE cert X509v3 Key Usage: critical Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment Here is the KeyUsage on one of my CA certs X509v3 Key Usage: critical Digital Signature, Non Repudiation, Certificate Sign, CRL Sign I think this is where the error is coming from in X509_check_issued. This is why this call is returning true ku_reject(issuer, KU_KEY_CERT_SIGN). Is my thinking correct on this matter? Matt This is what I need to do. I've been able to do it with a certificate chain that consists of my EE, an intermediate CA cert, self signed CA cert. But I have not been able to do it with this certificate chain Proxy certificate, EE, intermediate CA cert, self signed CA cert. I've been using gdb to trace through the X509_verify_cert function, The problem seems to be the it cannot find the issuer of my proxy certificate. This call happens on line 158 in x509_vfy.c. Since it can't find the issuer it can't build the cert_chain, and later a check for NULL on chain_ss is true so the X509_verify_cert functions exits with an error. Ok, so I stepped through the find_issuer code path where it was calling check_issued on the proxy certificate and the EE cert, which should return true, because the EE cert was the issuer for my proxy cert. I found that it was returning an error at the end of the check_issued function in this code block. Specifically else if condition was true. ku_reject(issuer, KU_KEY_CERT_SIGN) I think this means that my EE cert is not allowed to sign for other certs. Is that correct? if(subject->ex_flags & EXFLAG_PROXY) { if(ku_reject(issuer, KU_DIGITAL_SIGNATURE)) return X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE; } else if(ku_reject(issuer, KU_KEY_CERT_SIGN)) return X509_V_ERR_KEYUSAGE_NO_CERTSIGN; I've attached 2 programs, one is a server who presents a certificate chain. I'm using the SSL_CTX_use_certificate_chain_file to parse in the cert chain. The client calls SSL_CTX_load_verify_locations which points at a directory where the CA certs are kept. The client verifies the server, and has its own verify_cb, the server does not verify the client. One final note, to create the proxy the certificate I've used a globus program called grid-proxy-init. I'm not sure if you are familiar with that or not. Thanks for your help, I'm looking over the your proxy_certificates.txt documentation, if I see anything that could be clarified I'll let you know. Thanks for you help, Matt Rodriguez Here's my stack, which may help #0 X509_check_issued (issuer=0x8068840, subject=0x8067b58) at v3_purp.c:640 #1 0xb7f81c04 in check_issued (ctx=0xbfffe5f0, x=0x8067b58, issuer=0x8068840) at x509_vfy.c:351 #2 0xb7f81bbe in find_issuer (ctx=0xbfffe5f0, sk=0x806a3d8, x=0x8067b58) at x509_vfy.c:340 #3 0xb7f81681 in X509_verify_cert (ctx=0xbfffe5f0) at x509_vfy.c:158 #4 0xb7e986d7 in ssl_verify_cert_chain (s=0x8056aa0, sk=0x8067b28) at ssl_cert.c:515 #5 0xb7e871b9 in ssl3_get_server_certificate (s=0x8056aa0) at s3_clnt.c:862 #6 0xb7e86040 in ssl3_connect (s=0x8056aa0) at s3_clnt.c:296 #7 0xb7e94cf1 in SSL_connect (s=0x8056aa0) at ssl_lib.c:841 #8 0x08049034 in main (argc=1, argv=0xbfffe824) at client.c:38 If you need to care about the proxy policy rights and you're using SSL, you should read docs/HOWTO/proxy_certificates.txt, which explains how you should set up SSL verification callbacks to do that properly, with an example and all. MKRodriguez> 2) I need to be able
Re: proxy certificate support in openssl 0.9.8
Richard Levitte - VMS Whacker wrote: In message <[EMAIL PROTECTED]> on Tue, 15 Mar 2005 14:36:57 -0800, Matt Rodriguez <[EMAIL PROTECTED]> said: MKRodriguez> I've looking at the tests in the snapshots for 0.9.8. I MKRodriguez> am trying to figure out what functionality regarding MKRodriguez> proxy certificates has been implemented. Most importantly: - verification, as a change in the functions used by X509_verify_cert() - parsing of proxy certificate extensions in a configuration file. - implementation of internal ASN.1 structures for ProxyCertInfoExtensions and ProxyPolicy. MKRodriguez> Here are 2 things that I am looking for: MKRodriguez> MKRodriguez> 1) I need to be able to do a handshake using proxy MKRodriguez>certificates for client and server authentication. If you don't care about the rights assigned with the policy extensions, you can do it by just setting the certificate to use and the whole chain properly. A "catch" is the the whole chain, CA root cert, CA intermediate certs, EE cert and intermediate proxy certs are view as the issuing chain, and should be part of whatever you use as your CA certificate bundle. This is what I need to do. I've been able to do it with a certificate chain that consists of my EE, an intermediate CA cert, self signed CA cert. But I have not been able to do it with this certificate chain Proxy certificate, EE, intermediate CA cert, self signed CA cert. I've been using gdb to trace through the X509_verify_cert function, The problem seems to be the it cannot find the issuer of my proxy certificate. This call happens on line 158 in x509_vfy.c. Since it can't find the issuer it can't build the cert_chain, and later a check for NULL on chain_ss is true so the X509_verify_cert functions exits with an error. Ok, so I stepped through the find_issuer code path where it was calling check_issued on the proxy certificate and the EE cert, which should return true, because the EE cert was the issuer for my proxy cert. I found that it was returning an error at the end of the check_issued function in this code block. Specifically else if condition was true. ku_reject(issuer, KU_KEY_CERT_SIGN) I think this means that my EE cert is not allowed to sign for other certs. Is that correct? if(subject->ex_flags & EXFLAG_PROXY) { if(ku_reject(issuer, KU_DIGITAL_SIGNATURE)) return X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE; } else if(ku_reject(issuer, KU_KEY_CERT_SIGN)) return X509_V_ERR_KEYUSAGE_NO_CERTSIGN; I've attached 2 programs, one is a server who presents a certificate chain. I'm using the SSL_CTX_use_certificate_chain_file to parse in the cert chain. The client calls SSL_CTX_load_verify_locations which points at a directory where the CA certs are kept. The client verifies the server, and has its own verify_cb, the server does not verify the client. One final note, to create the proxy the certificate I've used a globus program called grid-proxy-init. I'm not sure if you are familiar with that or not. Thanks for your help, I'm looking over the your proxy_certificates.txt documentation, if I see anything that could be clarified I'll let you know. Thanks for you help, Matt Rodriguez Here's my stack, which may help #0 X509_check_issued (issuer=0x8068840, subject=0x8067b58) at v3_purp.c:640 #1 0xb7f81c04 in check_issued (ctx=0xbfffe5f0, x=0x8067b58, issuer=0x8068840) at x509_vfy.c:351 #2 0xb7f81bbe in find_issuer (ctx=0xbfffe5f0, sk=0x806a3d8, x=0x8067b58) at x509_vfy.c:340 #3 0xb7f81681 in X509_verify_cert (ctx=0xbfffe5f0) at x509_vfy.c:158 #4 0xb7e986d7 in ssl_verify_cert_chain (s=0x8056aa0, sk=0x8067b28) at ssl_cert.c:515 #5 0xb7e871b9 in ssl3_get_server_certificate (s=0x8056aa0) at s3_clnt.c:862 #6 0xb7e86040 in ssl3_connect (s=0x8056aa0) at s3_clnt.c:296 #7 0xb7e94cf1 in SSL_connect (s=0x8056aa0) at ssl_lib.c:841 #8 0x08049034 in main (argc=1, argv=0xbfffe824) at client.c:38 If you need to care about the proxy policy rights and you're using SSL, you should read docs/HOWTO/proxy_certificates.txt, which explains how you should set up SSL verification callbacks to do that properly, with an example and all. MKRodriguez> 2) I need to be able to verify a proxy certificate, given MKRodriguez>the certificate and certificate chain. X509_verify_cert() MKRodriguez> It looks like the testsslproxy does the tests the first MKRodriguez> requirement, but not the second. Maybe I misunderstand you, but I'm quite sure it does both. MKRodriguez> Does anybody know if the functionality I want has been MKRodriguez> implemented? What function calls will I have to make MKRodriguez> to do this, or what files should I be looking in? I know, since I implemented the stuff. I hope what I said above is satisfactory. If not, I'm up for talking about it. Maybe I need to document yet a bit better? Cheers, Richard #include "common.h" int main(int argc, char **argv){ int fd, ret = 1, filetype = SSL_FILETYPE
OpenSSL 0.9.7f released
-BEGIN PGP SIGNED MESSAGE- OpenSSL version 0.9.7f released == OpenSSL - The Open Source toolkit for SSL/TLS http://www.openssl.org/ The OpenSSL project team is pleased to announce the release of version 0.9.7f of our open source toolkit for SSL/TLS. This new OpenSSL version is a bugfix release and incorporates changes and bugfixes to the toolkit (for a complete list see http://www.openssl.org/source/exp/CHANGES ). The most significant changes are: o Several compilation issues fixed. o Many memory allocation failure checks added. o Improved comparison of X509 Name type. o Mandatory basic checks on certificates. o Performance improvements. We consider OpenSSL 0.9.7f to be the best version of OpenSSL available and we strongly recommend that users of older versions upgrade as soon as possible. OpenSSL 0.9.7f is available for download via HTTP and FTP from the following master locations (you can find the various FTP mirrors under http://www.openssl.org/source/mirror.html): o http://www.openssl.org/source/ o ftp://ftp.openssl.org/source/ The distribution file name is: o openssl-0.9.7f.tar.gz MD5 checksum: b2d37d7eb8a5a5040d834105d5ae1a50 The checksums were calculated using the following command: openssl md5 < openssl-0.9.7f.tar.gz Yours, The OpenSSL Project Team... Mark J. Cox Ben Laurie Andy Polyakov Ralf S. Engelschall Richard Levitte Geoff Thorpe Dr. Stephen Henson Bodo Möller Lutz JänickeUlf Möller Nils Larsch -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.4 (GNU/Linux) iQEVAwUBQkCOuqLSm3vylcdZAQGRhQgAq7E1Jc+3xeFm9qQiH4IRg5+9wekLWA0M sF5KtgNf+Ans9rRTd3jp5wc5GrUW04ZY7ppY2lNLG81aDmXoPVSRwpXxgaZ4dBEg ZUADOWcIM5mj1g+YbgdrHzCqkkAXT8p9RVxY40jgyn0GrOtXdmOFXTpuZp7Z62uU ctPVACSdrL9l9P4xpYhTOp3pnfUSYxXur7C2CQ59uiBitWP8jrArl74yn6l55K4q KLuSsZdoRZe/gi0Q4jZDt+dQYJtXItnrl2R98iOyx5WZiKuecb3MBLPz4hBRjIAN 3Cpbe8lFvQ951gMhqTR3aNQXRNAX3YZQqJAZsJz6uQLrId6+SX3/QA== =2EAs -END PGP SIGNATURE- __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
RE: RAND_Bytes in Windows CE (Pocket PC or smartphone)
The attached code will make it so that the RAND_screen function can be used to seed OpenSSL on CE. It replaces the readscreen function provided with the library in the crypto\rand\rand_win.c function. I have not tested it on non-CE devices, so you may want to #ifdef it in if you will be supporting standard Windows as well. static void readscreen(void) { HDC hdc, hdcScr; int nWidth, nHeight; BITMAPINFO dibInfo; BYTE *pBGR = NULL; HBITMAP hNewBitmap, hOldBitmap; int nBufSize; int nChunkSize; int y; // Take a snapshot of the screen hdcScr = GetDC(NULL); hdc = CreateCompatibleDC(hdcScr); // Get screen resolution nWidth = GetDeviceCaps(hdc, HORZRES); nHeight = GetDeviceCaps(hdc, VERTRES); // Fill in the DIB structure dibInfo.bmiHeader.biBitCount = 24; dibInfo.bmiHeader.biClrImportant = 0; dibInfo.bmiHeader.biClrUsed = 0; dibInfo.bmiHeader.biCompression = 0; dibInfo.bmiHeader.biHeight = nHeight; dibInfo.bmiHeader.biPlanes = 1; dibInfo.bmiHeader.biSize = 40; dibInfo.bmiHeader.biSizeImage = nWidth*nHeight*3; dibInfo.bmiHeader.biWidth = nWidth; dibInfo.bmiHeader.biXPelsPerMeter = 3780; dibInfo.bmiHeader.biYPelsPerMeter = 3780; dibInfo.bmiColors[0].rgbBlue = 0; dibInfo.bmiColors[0].rgbGreen = 0; dibInfo.bmiColors[0].rgbRed = 0; dibInfo.bmiColors[0].rgbReserved = 0; // Create a new device independent bitmap and retrieve // a pointer to its bit storage -- this is the raw // bitmap data that will be hashed hNewBitmap = CreateDIBSection(hdc, (const BITMAPINFO*)&dibInfo, DIB_RGB_COLORS, (void**)&pBGR, NULL, 0); hOldBitmap = (HBITMAP) SelectObject(hdc, hNewBitmap); // Copy the bitmap into the new device context -- this will // also copy the bitmap to the DIB BitBlt(hdc, 0, 0, nWidth, nHeight, hdcScr, 0, 0, SRCCOPY); // Determine the buffer size of the screen data nBufSize = 3 * nWidth * nHeight; nChunkSize = nBufSize / ( 3 * 16 ); /* Now go through the whole screen, repeatedly grabbing n lines */ for ( y = 0; y < nBufSize; y += nChunkSize ) { unsigned char md[MD_DIGEST_LENGTH]; /* Get the hash of the bitmap */ MD(pBGR + y, nChunkSize, md); /* Seed the random generator with the hash value */ RAND_seed(md, MD_DIGEST_LENGTH); } // Restore the empty bitmap to the device context -- this // clears up any potential resource leaks SelectObject(hdc, hOldBitmap); // Delete the DIB DeleteObject(hNewBitmap); // Done with the DCs. DeleteDC( hdc ); DeleteDC( hdcScr ); } The code is derived from an article in Dr. Dobb's Journal (December 2002, "Automated Testing & Windows CE"), so you should have no problems distributing it. Unfortunately, I haven't found a better way get random information on the CE devices. One additional suggestion would be to use the RAND_write_file and RAND_load_file functions each time you exit and restart your application. This will allow your randomness to "accumulate" each time your appliction is run. Brant Thomsen Sr. Software Engineer Wavelink Corporation > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Antonio Ruiz > Martínez > Sent: Tuesday, March 22, 2005 12:23 PM > To: openssl-users@openssl.org > Subject: RAND_Bytes in Windows CE (Pocket PC or smartphone) > > > Hello! > > I'm writing you because when I call to the function to make a pkcs#7 > enveloped data, I get the following error: > 1673169562:error:2406064:random number generator:SSLEAY_RAND_BYTES_PRNG > not seeded:.\crypto\rand\md_rand.c:503:You need to read the OpenSSL FAQ. > > I read it but the problems are related to Unix System, but what about > Windows CE? > Could you help me to solve it, please? > Thanks in advance, > Regards, > Antonio. __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: I couldn't get PEM_read_RSAPrivateKey to work
On Tue, Mar 22, 2005, Dohanyos Andras Balazs wrote: > Dear List! > > Please excuse me if I ask something obvious or RTFM rated, I was browsing > the > list archives and the openssl.org's docs all day, but couldn't find the > solutuion. > Try browsing the FAQ too... Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
I couldn't get PEM_read_RSAPrivateKey to work
Dear List! Please excuse me if I ask something obvious or RTFM rated, I was browsing the list archives and the openssl.org's docs all day, but couldn't find the solutuion. Here's my prob: I reduced my "program" in VC++ 7 to: >8 FILE *privKeyFile = fopen("D:\\Temp\\verify\\privkey.pem","r"); // keyLen = fread( keyBuff, 1, 4096, keyfile ); <- This was an attempt to verify the file, it did read if ( !privKeyFile ) // *Sigh* { printf( "privKeyFile not found" ); return; } RSA* tempRSA = PEM_read_RSAPrivateKey( privKeyFile, NULL, NULL, NULL ); >8 The last line leads to: int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data, long *len) /w all 5 params being valid in this fucnt, when the debug gets to: i=BIO_gets(bp,buf,254); It throws an Unhandled exception at 0x7c918fea in xy.exe: 0xC005: Access violation writing location 0x0010. I couldn't debug deeper b/c I couldn't find iodef.h and didn't have the VS install DVD at hand (it was stated on this list that it installs w/ the VS) Please lead me to the light :) Is it a known bug? Did i compile/install something wrong? Thanks in advance Balazs Here's my privkey.pem: (I generated it w/ the openssl.exe using some sample arguments) -BEGIN RSA PRIVATE KEY- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,16BE416AB451EDFA gA9zzr/3seeTNXUNi3ENLHpzOq75DScxu4DIQlTlZU44WcWMoxdRznC4BAh6hyxv o8pkg4kVFs4Ka5E7HGnHV/2N58kJgpLTB+nyLvZGUEbqVz5hdPEjO1bPUCVoJKd1 QSDDMHHyeXh3MapQ0Vw1xYGhR6Vp8w4r3pDNFPIrxBMk1PoLkMr1hOoMiRL1353F V5QNTwm/zJL/uz5v6Autd8lL49f107ouGstBDKetANy8NXdYp58UV/tQ3F2z84Gh u0jSWVchgihR3nw9ONJeyRFoifFg3DLcalHLrJ08IBYAiJdXrsSaoTSeZLU1Bg36 qsfeucfkctStjpWPYsfnkNczua9qeuuIpyvc25sz+HU/OPtN8h7OwDDzeAqZeHHT 6yT8HdAp2POEXH5jMvlYYVoiJ6uBxD0/xZoKCzCZl3DmGaamRmUjIH7afW9v/npz Fx1tgHtwrVF7Ind+9hKwhUTv9QIPm7kSz2deiP3bzKHUSrh0lhsgsnRGgGFwFqO2 oUXat0QauIabodxX8ta8+Oc7iqesa16sMgkJRRcqrv09H6PZZOiDSP/Mm0V09qoH CHKKLslfMFCp9SdUXFsCWo4dIR/wjZVFTDiuA4B8N5Z9UJ39BqRi6jafe/UnJYN6 Rid+C27+lgqSwvPG3lES89LcMOy+xPxy/BDFCvTanMy3pvfjRJvr7Lb4LBBV9QXs lOEmj0IloYUvq3L5iI8vwyocGvuv4sS9cQMAhXQN+skBFb+nlXdeSPdHPboOTMIq QuVa59y0BjdPIOYhoF8FEtriWWETpGfwsi7qdNx2/+ZR+0cDW+fJPA== -END RSA PRIVATE KEY- __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
RAND_Bytes in Windows CE (Pocket PC or smartphone)
Hello! I'm writing you because when I call to the function to make a pkcs#7 enveloped data, I get the following error: 1673169562:error:2406064:random number generator:SSLEAY_RAND_BYTES_PRNG not seeded:.\crypto\rand\md_rand.c:503:You need to read the OpenSSL FAQ. I read it but the problems are related to Unix System, but what about Windows CE? Could you help me to solve it, please? Thanks in advance, Regards, Antonio. -- -- Antonio Ruiz Martínez Faculty of Computer Science-University of Murcia 30071 Murcia - Spain e-mail: [EMAIL PROTECTED] or arm [at] dif [dot] um [dot] es -- __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
half-duplex socket and openssl
Hi I am programming network client-server system, I use custom protocol and I want to wrap network communication with SSL. The original concept without SSL is: client: ... connect(sfd,...); _write_request(sfd,...); shutdown(sfd,SHUT_WR); _read_response(sfd,...); close(sfd); server: ... sfd = accept(...); _read_request(sfd,...); // end reading when 0 bytes read _write_response(sfd,...); close(sfd); I use shutdown() so that server knows when it should stop reading data. To use SSL, I added SSL_connect(), SSL_accept(), SSL_write(), SSL_read() and other needed functions. First tests show that it works fine, but I am afraid of shutdown(). Server then can only write data to socket. man SSL_write() says "...As at any time a re-negotiation is possible, a call to SSL_write() can also cause read operations...". Should I replace my shutdown() with something else or is there any nicer solution? System runs on Linux and FreeBSD, I want to use non-blocking sockets (helping with poll()). Thanks for any help Pavol Gono __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: Build fails on AIX 5.3: Solution included.
Peter Schmiedeskamp wrote : Hi, during the process of compiling OpenSSL 0.9.7e on AIX 5.3, I ran into a compile issue whereby "fips_rand.c" attempted to redefine _XOPEN_SOURCE_EXTENDED which is already defined in AIX's system headers. Here's a patch that worked for me: --- fips_rand.c.orig2005-03-10 08:30:39.0 -0700 +++ fips_rand.c 2005-03-09 15:27:59.0 -0700 @@ -56,7 +56,9 @@ /* If we don't define _XOPEN_SOURCE_EXTENDED, struct timeval won't be defined and gettimeofday() won't be declared with strict compilers like DEC C in ANSI C mode. */ +#ifndef _XOPEN_SOURCE_EXTENDED #define _XOPEN_SOURCE_EXTENDED +#endif #include #include Hi there, the above patch also works on AIX 5.2. However, openssl built in 64bits mode fails SQR test: # openssl-0.9.7e > make test [... stuff deleted ...] starting big number library test, could take a while... test BN_add test BN_sub test BN_lshift1 test BN_lshift (fixed) test BN_lshift test BN_rshift1 test BN_rshift test BN_sqr Square test failed! gmake[1]: *** [test_bn] Error 1 gmake[1]: Leaving directory `/openssl-0.9.7e/test' gmake: *** [tests] Error 2 # openssl-0.9.7e > openssl version -a OpenSSL 0.9.7e 25 Oct 2004 built on: Tue Mar 22 15:25:44 NFT 2005 platform: aix43-cc options: bn(64,64) md2(int) rc4(ptr,char) des(idx,cisc,4,long) idea(int) blowfish(idx) compiler: cc -q64 -qwarn64 -DOPENSSL_THREADS -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_NO_KRB5 -O -DAIX -DB_ENDIAN -qmaxmem=16384 OPENSSLDIR: "/usr/local/ssl" # openssl-0.9.7e > file ./apps/openssl ./apps/openssl: 64-bit XCOFF executable or object module not stripped # openssl-0.9.7e > The same test fails with OpenSSL 0.9.7d. In addition to the above '-q64 and -qwarn64' options, I set OBJECT_MODE=64 environment variable to get 64bits binaries upon link. Both 0.9.7d and 0.9.7e successfully pass the BN_sqr test when built in 32bits mode. Any hint ? PS: Is OpenSSL on AIX 5.2 64bits still trustworthy with this failure in BN_sqr ? -- Mr. Jacques LEBASTARDmailto:[EMAIL PROTECTED] EVIDIAN S.A. www.evidian.com Rue Jean Jaurès Tel: +33 1 30 80 77 86 F-78340 LES CLAYES SOUS BOIS Fax: +33 1 30 80 77 99 __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: problem with revocation
In message <[EMAIL PROTECTED]> on Tue, 22 Mar 2005 15:09:54 +0100, François NOEL <[EMAIL PROTECTED]> said: f.noel> Ok So I must rebuild My CRL list Each time I revoke a f.noel> certificate with f.noel> openssl ca -config openssl.cnf -gencrl -out crl/ca.crl That or at regular intervals (if you end up revoking a lot of certificates in a row, you might not want to regenerate the CRL *each* *damn* *fscking* *time*! :-)). Cheers, Richard - Please consider sponsoring my work on free software. See http://www.free.lp.se/sponsoring.html for details. -- Richard Levitte [EMAIL PROTECTED] http://richard.levitte.org/ "When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." -- C.S. Lewis __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: problem with revocation
Dominique Lohez wrote: François NOEL wrote: Dominique Lohez wrote: François NOEL wrote: Hi I have some problems with revokating certs. when I type : openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem -verbose That update me "index.txt" but i don't anything in my crl/ca.crl file [EMAIL PROTECTED]:/home/fanfan/public_html/certif_env/essai_env# openssl crl -in crl/ca.crl -noout -text Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: md5WithRSAEncryption Issuer: /C=FR/ST=Calvados/O=Ingelis/OU=Stage/L=CAEN/CN=NOEL_Francois/[EMAIL PROTECTED] Last Update: Mar 22 13:02:01 2005 GMT Next Update: Apr 21 13:02:01 2005 GMT *No Revoked Certificates.* Signature Algorithm: md5WithRSAEncryption XX:XX:XX... The crl is not automatically generated each time you revocate a certificate You must create by a command such that openssl ca -gencrl a complete description of the options is described here http://www.openssl.org/docs/apps/ca.html#CRL_OPTIONS I made that : openssl ca -config openssl.cnf -out crl/ca.crl -gencrl before revokating any certs, and It doesn't work any more regards Dominique you must build the crl when at least one certificate has been revoked Dominique Ok So I must rebuild My CRL list Each type I revoke a certificate with openssl ca -config openssl.cnf -gencrl -out crl/ca.crl smime.p7s Description: S/MIME Cryptographic Signature
Re: EVP API for symetric encryption - problem
In message <[EMAIL PROTECTED]> on Mon, 21 Mar 2005 21:06:05 -0300, Rafael Cividanes <[EMAIL PROTECTED]> said: rafacividanes> I'm doing a little program to encrypt and decrypt rafacividanes> a string using the EVP API. I couldn't understand if I rafacividanes> have to use EVP_DecryptFinal_ex( ) or just rafacividanes> EVP_DecryptUpdate( ) in the decryption operation. The rafacividanes> second function return the entire recovered plaintext, rafacividanes> then I can't understand why EVP_DecryptFinal_ex( ) rafacividanes> exist. Just for checking error? EVP_DecryptFinal_ex() clears the padding that's tucked at the end of the ciphertext, and through the padding, it will also check that the decryption was correctly done. This ALSO applies to messages that are an exact multiple of 8 bytes (or whatever the cipher block size is) in length. rafacividanes> rafacividanes> Here is my code: rafacividanes> rafacividanes> int main(int argc, char *argv[]) rafacividanes> { rafacividanes> EVP_CIPHER_CTX ctx; rafacividanes> char key[EVP_MAX_KEY_LENGTH]; rafacividanes> char iv[EVP_MAX_IV_LENGTH]; rafacividanes> char intext[] = "The problem will be solved until12345"; //32 rafacividanes> rafacividanes> unsigned char outbuf[1024]; rafacividanes> unsigned char recover_msg[1024]; rafacividanes> unsigned char final[1024]; rafacividanes> int size_recover_msg, size_final; rafacividanes> int outlen, tmplen; rafacividanes> int i; rafacividanes> rafacividanes> printf("\n START!!! \n"); rafacividanes> RAND_screen(); rafacividanes> RAND_bytes(key, EVP_MAX_KEY_LENGTH); rafacividanes> RAND_bytes (iv, EVP_MAX_IV_LENGTH); rafacividanes> rafacividanes> //initialization rafacividanes> for (i=0; i<1024; i++){ rafacividanes> outbuf[i]='\0'; rafacividanes> recover_msg[i]='\0'; rafacividanes> final[i]='\0'; rafacividanes> } rafacividanes> rafacividanes> //encryption rafacividanes> EVP_CIPHER_CTX_init(&ctx); rafacividanes> EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc( ), NULL, key, iv); rafacividanes> rafacividanes> printf("\n EVP_CIPHER_CTX_key_length(&ctx): %d ", rafacividanes> EVP_CIPHER_CTX_key_length(&ctx)); rafacividanes> printf("\n Size of plaintext: %d \n", strlen(intext)); rafacividanes> rafacividanes> if(!EVP_EncryptUpdate(&ctx, outbuf, &outlen, intext, rafacividanes> strlen(intext))) rafacividanes> printf("\n ERROR! \n"); rafacividanes> rafacividanes> // Buffer passed to EVP_EncryptFinal() must be after data just rafacividanes> // encrypted to avoid overwriting it. rafacividanes> rafacividanes> if(!EVP_EncryptFinal_ex(&ctx, outbuf + outlen, rafacividanes> &tmplen)) rafacividanes> printf("\n ERROR!! \n"); rafacividanes> rafacividanes> outlen += tmplen; rafacividanes> rafacividanes> //print the ciphertext rafacividanes> printf("\n ciphertext: \n"); rafacividanes> for (i=0;i printf("\n"); rafacividanes> rafacividanes> EVP_CIPHER_CTX_cleanup(&ctx); rafacividanes> rafacividanes> //Decryption rafacividanes> if (!EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc( ), NULL, key, iv)) rafacividanes> printf("\n ERROR!! \n"); rafacividanes> rafacividanes> if (!EVP_DecryptUpdate(&ctx, recover_msg, &size_recover_msg, rafacividanes> outbuf, outlen)) rafacividanes> printf("\n ERROR!! \n"); rafacividanes> rafacividanes> if (!EVP_DecryptFinal_ex(&ctx, final, &size_final)) rafacividanes> printf("\n ERROR!! \n"); rafacividanes> rafacividanes> //print the recovered plaintext as a string rafacividanes> printf("\n recovered_plaintext1: \n %s \n", recover_msg); rafacividanes> rafacividanes> //print the recovered plaintext as an array rafacividanes> printf("\n recovered_plaintext2: \n "); rafacividanes> for (i=0;i<=size_recover_msg;i++) printf("%c",recover_msg[i]); rafacividanes> rafacividanes> //print the resultt of finalization phase rafacividanes> printf("\n\n final: %s \n", final); rafacividanes> printf("\n size_final = %d \n", size_final); rafacividanes> rafacividanes> EVP_CIPHER_CTX_cleanup(&ctx); rafacividanes> rafacividanes> }//end main rafacividanes> rafacividanes> Another thing I coundn't understand is why rafacividanes> "recovered_plaintext1" sometimes ataches trash when rafacividanes> printed in the screen, and sometimes doesn't. That "trash" is there because you didn't allow EVP_Decrypt_Final_ex() to do it's job properly, by directing it's output to final. You might also notice that the output "recovered_pla
Re: problem with revocation
François NOEL wrote: Dominique Lohez wrote: François NOEL wrote: Hi I have some problems with revokating certs. when I type : openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem -verbose That update me "index.txt" but i don't anything in my crl/ca.crl file [EMAIL PROTECTED]:/home/fanfan/public_html/certif_env/essai_env# openssl crl -in crl/ca.crl -noout -text Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: md5WithRSAEncryption Issuer: /C=FR/ST=Calvados/O=Ingelis/OU=Stage/L=CAEN/CN=NOEL_Francois/[EMAIL PROTECTED] Last Update: Mar 22 13:02:01 2005 GMT Next Update: Apr 21 13:02:01 2005 GMT *No Revoked Certificates.* Signature Algorithm: md5WithRSAEncryption XX:XX:XX... The crl is not automatically generated each time you revocate a certificate You must create by a command such that openssl ca -gencrl a complete description of the options is described here http://www.openssl.org/docs/apps/ca.html#CRL_OPTIONS I made that : openssl ca -config openssl.cnf -out crl/ca.crl -gencrl before revokating any certs, and It doesn't work any more regards Dominique you must build the crl when at least one certificate has been revoked Dominique -- Dr Dominique LOHEZ ISEN 41, Bd Vauban F59046 LILLE France Phone : +33 (0)3 20 30 40 71 Email: [EMAIL PROTECTED] __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: problem with revocation
Richard Levitte - VMS Whacker wrote: In message <[EMAIL PROTECTED]> on Tue, 22 Mar 2005 14:15:15 +0100, François NOEL <[EMAIL PROTECTED]> said: f.noel> Hi I have some problems with revokating certs. f.noel> when I type : f.noel> f.noel> openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem f.noel> -verbose f.noel> f.noel> That update me "index.txt" but i don't anything in my crl/ca.crl file You need to regenerate your CRL file, like this: openssl ca -config ./openssl.cnf -gencrl -out crl/ca.crl It was created before I try to revoke. cheer François Cheers, Richard - Please consider sponsoring my work on free software. See http://www.free.lp.se/sponsoring.html for details. smime.p7s Description: S/MIME Cryptographic Signature
Re: problem with revocation
Dominique Lohez wrote: François NOEL wrote: Hi I have some problems with revokating certs. when I type : openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem -verbose That update me "index.txt" but i don't anything in my crl/ca.crl file [EMAIL PROTECTED]:/home/fanfan/public_html/certif_env/essai_env# openssl crl -in crl/ca.crl -noout -text Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: md5WithRSAEncryption Issuer: /C=FR/ST=Calvados/O=Ingelis/OU=Stage/L=CAEN/CN=NOEL_Francois/[EMAIL PROTECTED] Last Update: Mar 22 13:02:01 2005 GMT Next Update: Apr 21 13:02:01 2005 GMT *No Revoked Certificates.* Signature Algorithm: md5WithRSAEncryption XX:XX:XX... The crl is not automatically generated each time you revocate a certificate You must create by a command such that openssl ca -gencrl a complete description of the options is described here http://www.openssl.org/docs/apps/ca.html#CRL_OPTIONS I made that : openssl ca -config openssl.cnf -out crl/ca.crl -gencrl before revokating any certs, and It doesn't work any more regards Dominique smime.p7s Description: S/MIME Cryptographic Signature
Re: problem with revocation
In message <[EMAIL PROTECTED]> on Tue, 22 Mar 2005 14:15:15 +0100, François NOEL <[EMAIL PROTECTED]> said: f.noel> Hi I have some problems with revokating certs. f.noel> when I type : f.noel> f.noel> openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem f.noel> -verbose f.noel> f.noel> That update me "index.txt" but i don't anything in my crl/ca.crl file You need to regenerate your CRL file, like this: openssl ca -config ./openssl.cnf -gencrl -out crl/ca.crl Cheers, Richard - Please consider sponsoring my work on free software. See http://www.free.lp.se/sponsoring.html for details. -- Richard Levitte [EMAIL PROTECTED] http://richard.levitte.org/ "When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." -- C.S. Lewis __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: problem with revocation
On Tue, Mar 22, 2005, François NOEL wrote: > Hi I have some problems with revokating certs. > when I type : > > openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem > -verbose > > That update me "index.txt" but i don't anything in my crl/ca.crl file > > [EMAIL PROTECTED]:/home/fanfan/public_html/certif_env/essai_env# openssl > crl -in crl/ca.crl -noout -text > Certificate Revocation List (CRL): >Version 1 (0x0) >Signature Algorithm: md5WithRSAEncryption >Issuer: > /C=FR/ST=Calvados/O=Ingelis/OU=Stage/L=CAEN/CN=NOEL_Francois/[EMAIL PROTECTED] >Last Update: Mar 22 13:02:01 2005 GMT >Next Update: Apr 21 13:02:01 2005 GMT > *No Revoked Certificates.* >Signature Algorithm: md5WithRSAEncryption > XX:XX:XX... > Try ca -gencrl to generate a new CRL. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: problem with revocation
François NOEL wrote: Hi I have some problems with revokating certs. when I type : openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem -verbose That update me "index.txt" but i don't anything in my crl/ca.crl file [EMAIL PROTECTED]:/home/fanfan/public_html/certif_env/essai_env# openssl crl -in crl/ca.crl -noout -text Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: md5WithRSAEncryption Issuer: /C=FR/ST=Calvados/O=Ingelis/OU=Stage/L=CAEN/CN=NOEL_Francois/[EMAIL PROTECTED] Last Update: Mar 22 13:02:01 2005 GMT Next Update: Apr 21 13:02:01 2005 GMT *No Revoked Certificates.* Signature Algorithm: md5WithRSAEncryption XX:XX:XX... The crl is not automatically generated each time you revocate a certificate You must create by a command such that openssl ca -gencrl a complete description of the options is described here http://www.openssl.org/docs/apps/ca.html#CRL_OPTIONS regards Dominique -- Dr Dominique LOHEZ ISEN 41, Bd Vauban F59046 LILLE France Phone : +33 (0)3 20 30 40 71 Email: [EMAIL PROTECTED] __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
problem with revocation
Hi I have some problems with revokating certs. when I type : openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem -verbose That update me "index.txt" but i don't anything in my crl/ca.crl file [EMAIL PROTECTED]:/home/fanfan/public_html/certif_env/essai_env# openssl crl -in crl/ca.crl -noout -text Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: md5WithRSAEncryption Issuer: /C=FR/ST=Calvados/O=Ingelis/OU=Stage/L=CAEN/CN=NOEL_Francois/[EMAIL PROTECTED] Last Update: Mar 22 13:02:01 2005 GMT Next Update: Apr 21 13:02:01 2005 GMT *No Revoked Certificates.* Signature Algorithm: md5WithRSAEncryption XX:XX:XX... smime.p7s Description: S/MIME Cryptographic Signature
problem with revocation
Hi I have some problems with revokating certs. when I type : openssl ca -config ./openssl.cnf -revoke ./newcerts/NOEL_Francois.pem -verbose That update me "index.txt" but i don't anything in my crl/ca.crl file [EMAIL PROTECTED]:/home/fanfan/public_html/certif_env/essai_env# openssl crl -in crl/ca.crl -noout -text Certificate Revocation List (CRL): Version 1 (0x0) Signature Algorithm: md5WithRSAEncryption Issuer: /C=FR/ST=Calvados/O=Ingelis/OU=Stage/L=CAEN/CN=NOEL_Francois/[EMAIL PROTECTED] Last Update: Mar 22 13:02:01 2005 GMT Next Update: Apr 21 13:02:01 2005 GMT No Revoked Certificates. Signature Algorithm: md5WithRSAEncryption XX:XX:XX... smime.p7s Description: S/MIME Cryptographic Signature
Re: EVP API for symetric encryption - problem
On Tue, Mar 22, 2005, Rafael Cividanes wrote: >But the problem is that the plaintext below has 37 characters! "The > problem will be solved until" = 32. > I see, I was mislead by the comment at the end. > char intext[] = "The problem will be solved until12345"; = 37 !! > > It's very strange for me! > The actual code you have without EVP_DecryptFinal_ex() *not* displaying the complete plaintext properly. If you look at the output with a hex editor you'll see that there are some extra 0xb characters on the end. The reason you sometimes get garbage is that the null terminator is not included when the length of the plaintext is determined. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]
Re: EVP API for symetric encryption - problem
But the problem is that the plaintext below has 37 characters! "The problem will be solved until" = 32. char intext[] = "The problem will be solved until12345"; = 37 !! It's very strange for me! Thanks, Rafael Dr. Stephen Henson wrote: On Mon, Mar 21, 2005, Rafael Cividanes wrote: I'm doing a little program to encrypt and decrypt a string using the EVP API. I couldn't understand if I have to use EVP_DecryptFinal_ex( ) or just EVP_DecryptUpdate( ) in the decryption operation. The second function return the entire recovered plaintext, then I can't understand why EVP_DecryptFinal_ex( ) exist. Just for checking error? Here is my code: int main(int argc, char *argv[]) { EVP_CIPHER_CTX ctx; char key[EVP_MAX_KEY_LENGTH]; char iv[EVP_MAX_IV_LENGTH]; char intext[] = "The problem will be solved until12345"; //32 In that example you'll be able to receive all the data because EVP_DecryptFinal_ex() wont have a partial final block to recover. The reason is that the plaintext is a multiple of the block length (16 for AES). If you try it with plaintext that isn't an exact multiple of the block size you'll see the difference. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED] -- Rafael Cividanes Instituto Tecnológico de Aeronáutica - ITA Divisão de Ciência da Computação - IEC Pça. Mal.Eduardo Gomes, 50 Vila das Acácias CTA-ITA-IEP12.228-900 São José dos Campos,SP Prédio da Guerra Eletrônica - Sala 235 Tel 12-39476891 E-mail: [EMAIL PROTECTED] __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]