RE: How to avoid patch of Solaris x86 linker

2008-02-04 Thread Ted Mittelstaedt

I thought at one time there was a patch for a gcc version that
also worked around Sun's buggy linker.

Ted

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of A V
 Sent: Saturday, February 02, 2008 3:30 PM
 To: openssl-users@openssl.org
 Subject: Re: How to avoid patch of Solaris x86 linker
 
 
 Thank you Bobby for your response.
 Sorry, I did not mention that using gcc 3.4/glibc 2.3 is a 
 requirement for me.
 
 Andrea
 
 
 On Feb 3, 2008 12:06 AM, Bobby Krupczak [EMAIL PROTECTED] wrote:
  Hi!
 
 
   I'm developing a static library that uses openssl library (0.9.8d).
   I experienced the same bug that is reported in the PROBLEMS file,
   inside the openssl distribution:
   There is a subtle Solaris x86-specific gcc run-time 
 environment bug, which
 falls between OpenSSL [0.9.8 and later], Solaris ld and 
 GCC. The bug
 manifests itself as Segmentation Fault upon early 
 application start-up.
 The problem can be worked around by patching the 
 environment according to
 http://www.openssl.org/~appro/values.c.;
  
   Tha patch works perfectly but, since I develop a static library, I
   would like to not force my users to patch their OS.
   Is it possible to avoid the Solaris patch, patching the openssl
   library or changing some of its compilation settings?
 
  Punt on gcc for solaris/x86 (solaris altogther?) and use the free
  solaris compiler available via the web.
 
  Once I switched compilers, I was able to build 0.9.8g and use it w/o
  any problems.
 
  Bobby
  __
  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: Unable to verify or decrypt a smime message generated with bouncycastle

2008-02-04 Thread Peter Van Biesen
-decrypt does not work without a key. I used an invalid key and I get 
following error :

Error decrypting PKCS#7 structure
13136:error:21070092:PKCS7 routines:PKCS7_dataDecode:no recipient matches 
key:pk7_doit.c:482:
13136:error:21072077:PKCS7 routines:PKCS7_decrypt:decrypt 
error:pk7_smime.c:470:

Which seems like a good and sensible error message. Using the correct private 
key decrypts the message.

I was looking for a way to get some information from the message ( 
like -info ) without trying to decrypt it, but apparently no such option 
exists ? It would be nice if I could say to my customer : you did not encrypt 
the message with our public key, I can see that you used key XYZ ...

Does the above error say that the pkcs7 is correct but the key was not found ? 
What happens when the pkcs7 is incorrect ? 

Anyway, this I can check on my own. Thanks a bunch for the help !

Peter.

On Friday 01 February 2008 18:09:27 Dr. Stephen Henson wrote:
 On Fri, Feb 01, 2008, Peter Van Biesen wrote:
  Are you saying that if I do not have the private key -verify says :
 
  wrong content type
 
  how does openssl know which key to use for decryption/verification ? Or
  does it just try them all ? I have difficulty to believe that no
  information can be retrieved from the pkcs7 container without the use of
  the private key .
 
  FYI : the reason I'm trying this is is because some messages do not
  decrypt and I need a way to debug the communication. Btw, the messages I
  attached previously were correctly processed ones, not faulty ones.

 There are indications in the message which allow the correct key to be
 identified.

 That error is caused by you attempting to perform and operation that is
 inconsistent with the content type.

 In this case you have an envelopedData type and you are attempting to
 verify a signature which is only performed on the signedData type.

 Instead of -verify try the -decrypt option to the smime utility and see
 what (if any) error messages you get.

 Steve.
 --
 Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
 OpenSSL project core developer and freelance consultant.
 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]



-- 
Peter Van Biesen
Sysadmin VAPH

tel: +32 (0) 2 225 85 70
fax: +32 (0) 2 225 85 88
e-mail: [EMAIL PROTECTED]
PGP: http://www.vaph.be/pgpkeys


signature.asc
Description: This is a digitally signed message part.


What stands EVP for

2008-02-04 Thread Thomas Mangold

I'm new to openssl trying to integrate encryption into my C code.
Reading and trying to understand the concepts I wondered what EVP_* from 
the higlevel routines stands for.
I could not find any explanation of this abbreviation in the 
documentation or on the web.


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


verify a pdf document with a pkcs7 signature

2008-02-04 Thread Sebastian Patschorke

Hello!

I don't know how to use openssl, that it verifies me a signature for a 
pdf document. This is what I tried:


openssl smime -verify -in RGF131361240.pdf -signer 799562928.crt -out 
RGF131361240.pdf.pkcs7


RGF131361240.pdf is the original document, RGF131361240.pdf.pkcs7 the 
signature and 799562928.crt contains the certificate.


I got only this:
Error reading S/MIME message
28968:error:2107A087:PKCS7 routines:SMIME_read_PKCS7:no content 
type:pk7_mime.c:296


Can someone please help me?
Thanks

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


Compiling on a Mac

2008-02-04 Thread Joel Christner
Hi everyone,

I'm having a build issue on a Mac (10.5) that resembles the problem
mentioned on the FAQ page:

http://www.openssl.org/support/faq.html#BUILD9

I searched my HDD for a 'PROBLEMS' file and the only one I found was for
emacs.

mac# openssl version
OpenSSL 0.9.7l 28 Sep 2006

The issue I'm seeing is when compiling:

mac# gcc blowfish.c -o blowfish
...
Undefined symbols:
  _incremental_send, referenced from:
  _incremental_encrypt in ccbqFUEC.o
  _incremental_finish in ccbqFUEC.o
  _EVP_DecryptUpdate, referenced from:
  _decrypt_example in ccbqFUEC.o
  _EVP_EncryptInit, referenced from:
  _setup_for_encryption in ccbqFUEC.o
  _main in ccbqFUEC.o
  _EVP_bf_cbc, referenced from:
  _setup_for_encryption in ccbqFUEC.o
  _setup_for_decryption in ccbqFUEC.o
  _main in ccbqFUEC.o
  _main in ccbqFUEC.o
  _RAND_pseudo_bytes, referenced from:
  _select_random_iv in ccbqFUEC.o
  _EVP_DecryptFinal, referenced from:
  _main in ccbqFUEC.o
  _EVP_EncryptUpdate, referenced from:
  _encrypt_example in ccbqFUEC.o
  _encrypt_example in ccbqFUEC.o
  _incremental_encrypt in ccbqFUEC.o
  _EVP_DecryptInit, referenced from:
  _setup_for_decryption in ccbqFUEC.o
  _main in ccbqFUEC.o
  _RAND_bytes, referenced from:
  _select_random_key in ccbqFUEC.o
  _EVP_EncryptFinal, referenced from:
  _encrypt_example in ccbqFUEC.o
  _incremental_finish in ccbqFUEC.o
  _seed_prng, referenced from:
  _setup_for_encryption in ccbqFUEC.o
  _main in ccbqFUEC.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Does anyone have any pointers or tips on how to rectify this?

Thanks for your help,
Joel


Compilation failure on Solaris v10 for Sun SPARC

2008-02-04 Thread Morgan, Christopher-P54187
Hi, 

I'm getting failures to build the version 1.1.2 FIP version of OpenSSL.
Here what I am doing (that results in the Make failing). Do you know
what I am doing incorrectly?

1.) ./config fips shared --openssldir=$HOME/myOpensslBuild
2.) make

Here is my Makefile that is generated and the compilation error problem.

Thank you.
Chris



Christopher A. Morgan, MSEE, MBA
MUOS - Satellite Control Segment
General Dynamics C4 Systems
Space and National Systems Division 
8201 E. McDowell Rd.Scottsdale, AZ  85257   Mail Stop H1177
Phone: (480) 441-8436   Fax: (480) 441-6843 
Email:  [EMAIL PROTECTED]
Skytel Pager: [EMAIL PROTECTED] or 1-800-203-1174
---
This email message is for the sole use of the intended recipient(s) and
may contain GDC4S confidential or privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited. If
you are not an intended recipient, please contact the sender by reply
email and destroy all copies of the original message.




Re: What stands EVP for

2008-02-04 Thread Jorge Fernandez
2008/2/2, Thomas Mangold [EMAIL PROTECTED]:

 I'm new to openssl trying to integrate encryption into my C code.
 Reading and trying to understand the concepts I wondered what EVP_* from
 the higlevel routines stands for.
 I could not find any explanation of this abbreviation in the
 documentation or on the web.


Already answered:
http://www.mail-archive.com/openssl-users@openssl.org/msg37558.html

Regards,


-- 
Jorge Fernandez


RE: Compiling on a Mac

2008-02-04 Thread Ted Mittelstaedt
Joel,

 Before compiling anything on the Mac you need to read the documents on the
Apple
website that discuss how to setup your environment properly and how to issue
the
correct C compilation commands.  Also the make on MacOS X doesen't support
all
of the features that make on some other platforms does - you might want to
start by
installing gmake.

Note also that if your
planning on distributing it you will likely want to build a PPC version as
well as an
Intel version.

Ted
  -Original Message-
  From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Joel Christner
  Sent: Sunday, February 03, 2008 1:14 PM
  To: openssl-users@openssl.org
  Subject: Re: Compiling on a Mac


  blowfish.c is a progam I wrote which contained a series of methods for
initializing, encrypting, and decrypting.

  Joel


  On Feb 3, 2008 10:51 AM, David Schwartz [EMAIL PROTECTED] wrote:



 mac# gcc blowfish.c -o blowfish


Where did you get this command from and what was it supposed to
accomplish?

DS


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




Re: verify a pdf document with a pkcs7 signature

2008-02-04 Thread Victor Duchovni
On Sat, Feb 02, 2008 at 08:33:40PM +0100, Sebastian Patschorke wrote:

 I don't know how to use openssl, that it verifies me a signature for a 
 pdf document. This is what I tried:
 
 openssl smime -verify -in RGF131361240.pdf -signer 799562928.crt -out 
 RGF131361240.pdf.pkcs7

Why smime. A PDF document is not a mime message. Try openssl dgst
instead, but you need a detached signature for that. If PDF files
have a way of encapsulating signed content, you need specialized tools
to verify those signatures.

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


Re: Unable to verify or decrypt a smime message generated with bouncycastle

2008-02-04 Thread Victor Duchovni
On Mon, Feb 04, 2008 at 09:34:00AM +0100, Peter Van Biesen wrote:

 -decrypt does not work without a key. I used an invalid key and I get 
 following error :
 
 Error decrypting PKCS#7 structure
 13136:error:21070092:PKCS7 routines:PKCS7_dataDecode:no recipient matches 
 key:pk7_doit.c:482:
 13136:error:21072077:PKCS7 routines:PKCS7_decrypt:decrypt 
 error:pk7_smime.c:470:
 
 Which seems like a good and sensible error message. Using the correct private 
 key decrypts the message.
 
 I was looking for a way to get some information from the message ( 
 like -info ) without trying to decrypt it, but apparently no such option 
 exists ? It would be nice if I could say to my customer : you did not encrypt 
 the message with our public key, I can see that you used key XYZ ...
 
 Does the above error say that the pkcs7 is correct but the key was not found 
 ? 

S/MIME first signs, then encrypts, so you can't check the signature without
decrypting.

http://world.std.com/~dtd/sign_encrypt/sign_encrypt7.html

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


Re: Compiling on a Mac

2008-02-04 Thread Joel Christner
Hi Ted,

Thanks, I will do that.  Any pointers on a quick fix would be appreciated
too.



On Feb 4, 2008 3:07 AM, Ted Mittelstaedt [EMAIL PROTECTED] wrote:

  Joel,

  Before compiling anything on the Mac you need to read the documents on
 the Apple
 website that discuss how to setup your environment properly and how to
 issue the
 correct C compilation commands.  Also the make on MacOS X doesen't support
 all
 of the features that make on some other platforms does - you might want to
 start by
 installing gmake.

 Note also that if your
 planning on distributing it you will likely want to build a PPC version as
 well as an
 Intel version.

 Ted

 -Original Message-
 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] Behalf Of *Joel Christner
 *Sent:* Sunday, February 03, 2008 1:14 PM
 *To:* openssl-users@openssl.org
 *Subject:* Re: Compiling on a Mac

 blowfish.c is a progam I wrote which contained a series of methods for
 initializing, encrypting, and decrypting.

 Joel

 On Feb 3, 2008 10:51 AM, David Schwartz [EMAIL PROTECTED] wrote:

 
 
   mac# gcc blowfish.c -o blowfish
 
  Where did you get this command from and what was it supposed to
  accomplish?
 
  DS
 
 
  __
  OpenSSL Project http://www.openssl.org
  User Support Mailing Listopenssl-users@openssl.org
  Automated List Manager   [EMAIL PROTECTED]
 




Sample code to connect to stunnel server

2008-02-04 Thread Alessandro Pivi - GLOBALcom engineering

Hi,

I need to make an SSL connectione between a client and a server 
application, both developed by me.
On the server side I am going to use stunnel, while on the client side I 
can't use stunnel, I must use the ssl library.


I tried to write the code to do it, but I can't connect.
This is the output of stunnel:

2008.02.04 17:30:48 LOG7[6385:1077001280]: kstunnel accepted FD=6 from 
127.0.0.1:33208

2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel started
2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 6 in non-blocking mode
2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 7 in non-blocking mode
2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 8 in non-blocking mode
2008.02.04 17:30:48 LOG7[6385:1077070768]: Connection from 
127.0.0.1:33208 permitted by libwrap
2008.02.04 17:30:48 LOG5[6385:1077070768]: kstunnel connected from 
127.0.0.1:33208

2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 7 in non-blocking mode
2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel connecting 
192.168.0.180:3000

2008.02.04 17:30:48 LOG7[6385:1077070768]: connect_wait: waiting 10 seconds
2008.02.04 17:30:48 LOG7[6385:1077070768]: connect_wait: connected
2008.02.04 17:30:48 LOG7[6385:1077070768]: Remote FD=7 initialized
2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL state (connect): 
before/connect initialization

2008.02.04 17:30:48 LOG7[6385:1077001280]: Cleaning up the signal pipe
2008.02.04 17:30:48 LOG6[6385:1077001280]: Child process 6550 finished 
with code 0
2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL state (connect): SSLv3 
write client hello A
2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL alert (write): fatal: 
unexpected_message
2008.02.04 17:30:48 LOG3[6385:1077070768]: SSL_connect: 14092072: 
error:14092072:SSL routines:SSL3_GET_SERVER_HELLO:bad message type
2008.02.04 17:30:48 LOG5[6385:1077070768]: Connection reset: 0 bytes 
sent to SSL, 0 bytes sent to socket

2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel finished (0 left)


I would like to know where to find sample C code to make an SSL 
connection to an stunnel server (better if with and without certificate 
verification).


Thanks in advance.

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


Re: measure network throughput in openssl

2008-02-04 Thread Marek . Marcola
Hello,
   is there any possibility of measuring network throughput using
 openssl tool. if so can u please give details
openssl is not very good tool to measure network throughput 
because transmitted data is encrypted which requires high
CPU usage. You may have situation when your PC/computer will not
be able to saturate network because of CPU bottleneck.
 
   Also i need details about the transmittred handshake data amount..
Just use:
 $ openssl s_client -conenct ip:port -msg
to look how big handshake messages you have.

Best regards,
--
Marek Marcola [EMAIL PROTECTED]

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


RE: Compiling on a Mac

2008-02-04 Thread David Schwartz

 Sorry I didn't update the list, but I tried with
 -lssl and -lcrypto, as well as -I/usr/include/openssl.

And what happened? Did you get the same error messages or different ones?

 I've reinstalled openssl to no avail.

What directories did you install to? And did you tell your compiler/linker
to look in the right place?

 Any other thoughts?

Typical include lines look like this:

#include openssl/opensslconf.h

So adding /usr/include/openssl to the includes will only help if you
installed the opensslconf.h file as
/usr/include/openssl/openssl/opensslconf.h which doesn't seem to make much
sense.

Also, what file did '-lssl' actually wind up linking to? Was it the file you
installed or some other file, perhaps one that came with your system?

DS


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


Re: Sample code to connect to stunnel server

2008-02-04 Thread Marek . Marcola
Hello,
 I need to make an SSL connectione between a client and a server 
 application, both developed by me.
 On the server side I am going to use stunnel, while on the client side I 

 can't use stunnel, I must use the ssl library.
 
 I tried to write the code to do it, but I can't connect.
 This is the output of stunnel:
 
 2008.02.04 17:30:48 LOG7[6385:1077001280]: kstunnel accepted FD=6 from 
 127.0.0.1:33208
 2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel started
 2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 6 in non-blocking mode
 2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 7 in non-blocking mode
 2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 8 in non-blocking mode
 2008.02.04 17:30:48 LOG7[6385:1077070768]: Connection from 
 127.0.0.1:33208 permitted by libwrap
 2008.02.04 17:30:48 LOG5[6385:1077070768]: kstunnel connected from 
 127.0.0.1:33208
 2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 7 in non-blocking mode
 2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel connecting 
 192.168.0.180:3000
 2008.02.04 17:30:48 LOG7[6385:1077070768]: connect_wait: waiting 10 
seconds
 2008.02.04 17:30:48 LOG7[6385:1077070768]: connect_wait: connected
 2008.02.04 17:30:48 LOG7[6385:1077070768]: Remote FD=7 initialized
 2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL state (connect): 
 before/connect initialization
 2008.02.04 17:30:48 LOG7[6385:1077001280]: Cleaning up the signal pipe
 2008.02.04 17:30:48 LOG6[6385:1077001280]: Child process 6550 finished 
 with code 0
 2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL state (connect): SSLv3 
 write client hello A
 2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL alert (write): fatal: 
 unexpected_message
 2008.02.04 17:30:48 LOG3[6385:1077070768]: SSL_connect: 14092072: 
 error:14092072:SSL routines:SSL3_GET_SERVER_HELLO:bad message type
 2008.02.04 17:30:48 LOG5[6385:1077070768]: Connection reset: 0 bytes 
 sent to SSL, 0 bytes sent to socket
 2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel finished (0 left)
 
 
 I would like to know where to find sample C code to make an SSL 
 connection to an stunnel server (better if with and without certificate 
 verification).
I do not know stunnel but from this messages this looks like this 
application
has bad configuration because it behaves like client - not server.
To be sure try to connect with:
$ openssl s_client -connect ip:port -debug -msg

Best regards,
--
Marek Marcola [EMAIL PROTECTED]

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


RE: Compiling on a Mac

2008-02-04 Thread David Schwartz

 On Feb 3, 2008 10:51 AM, David Schwartz [EMAIL PROTECTED] wrote:
 mac# gcc blowfish.c -o blowfish

 Where did you get this command from and what
 was it supposed to accomplish?

 blowfish.c is a progam I wrote which contained a series of methods for
 initializing, encrypting, and decrypting.
 Joel

Okay, and you issued a command to compile and link your program in a single
step. The compilation succeeded, as you have no compiler errors. The linking
failed. You'll notice that you have an undefined symbol error for every
single symbol in the OpenSSL library that you tried to use. This means no
attempt was made to link to the OpenSSL library. That shouldn't be
surprising, since you didn't tell the compiler to link to the OpenSSL
library.

DS


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


Re: Compiling on a Mac

2008-02-04 Thread Joel Christner
Sorry I didn't update the list, but I tried with -lssl and -lcrypto, as well
as -I/usr/include/openssl.  I've reinstalled openssl to no avail.

Any other thoughts?

Thanks

On Feb 4, 2008 9:43 AM, David Schwartz [EMAIL PROTECTED] wrote:


  On Feb 3, 2008 10:51 AM, David Schwartz [EMAIL PROTECTED] wrote:
  mac# gcc blowfish.c -o blowfish

  Where did you get this command from and what
  was it supposed to accomplish?

  blowfish.c is a progam I wrote which contained a series of methods for
  initializing, encrypting, and decrypting.
  Joel

 Okay, and you issued a command to compile and link your program in a
 single
 step. The compilation succeeded, as you have no compiler errors. The
 linking
 failed. You'll notice that you have an undefined symbol error for every
 single symbol in the OpenSSL library that you tried to use. This means no
 attempt was made to link to the OpenSSL library. That shouldn't be
 surprising, since you didn't tell the compiler to link to the OpenSSL
 library.

 DS


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



Re: verify a pdf document with a pkcs7 signature

2008-02-04 Thread Dr. Stephen Henson
On Sat, Feb 02, 2008, Sebastian Patschorke wrote:

 Hello!

 I don't know how to use openssl, that it verifies me a signature for a pdf 
 document. This is what I tried:

 openssl smime -verify -in RGF131361240.pdf -signer 799562928.crt -out 
 RGF131361240.pdf.pkcs7

 RGF131361240.pdf is the original document, RGF131361240.pdf.pkcs7 the 
 signature and 799562928.crt contains the certificate.

 I got only this:
 Error reading S/MIME message
 28968:error:2107A087:PKCS7 routines:SMIME_read_PKCS7:no content 
 type:pk7_mime.c:296

 Can someone please help me?
 Thanks


If the *.pkcs7 file is in binary format this would be a starting point:

openssl smime -verify -in foo.pkcs7 -content foo.pdf -inform DER -binary

that will probably complain about being unable to find the issuer certificate.
For testing purposes you can include the -noverify option which will tell you
it has otherwise checked the signature.

If that works you need to trust the appropriate root CA(s) and pass them to it
using the -CAfile or -CApath options.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
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]


Fwd: An OpenSSL server with NULL cipher support

2008-02-04 Thread JCA
OK, I found it. In case this helps somebody out there, the way it
works for me is the following:

The client is invoked as

openssl s_client -connect 127.0.0.1:443 -cipher COMPLEMENTOFALL:aNULL

and the server as

openssl s_server -msg -accept 443 -nocert -cipher COMPLEMENTOFALL:aNULL

With this, the server accepts the TLS_RSA_WITH_NULL_SHA ciphersuite
without complaints.




-- Forwarded message --
From: JCA [EMAIL PROTECTED]
Date: Feb 3, 2008 9:44 AM
Subject: An OpenSSL server with NULL cipher support
To: openssl-users@openssl.org


I am trying to use the openssl command line utility in order to
launch an SSL server supporting the NULL encryption cipher (I am
trying to debug a simple SSL client.) To that effect, I launch openssl
as follows:

# openssl s_server -accept 443 -nocert -WWW -cipher 'ALL:NULL'

The client is proposing the following ciphersuites:

  TLS_RSA_WITH_NULL_SHA
  TLS_RSA_WITH_NULL_MD5

But the server does not like this at all :-( It always replies with

20962:error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared
cipher:s3_srvr.c:974:

  Is there a simple way to achieve what I want? I am using OpenSSL
0.9.8e under Slackware 12, the OpenSSL having been compiled with NULL
cipher support.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: An OpenSSL server with NULL cipher support

2008-02-04 Thread Victor Duchovni
On Sun, Feb 03, 2008 at 09:44:03AM -0800, JCA wrote:

 I am trying to use the openssl command line utility in order to
 launch an SSL server supporting the NULL encryption cipher (I am
 trying to debug a simple SSL client.) To that effect, I launch openssl
 as follows:

You are not being specific about what you mean by NULL. TLS provides
both encryption with no authentication (aNULL ciphers) and authentication
with no encryption (eNULL ciphers). The default cipher list includes
only ciphersuites with both authentication and encryption.

Authentication requires a server certificate.

 # openssl s_server -accept 443 -nocert -WWW -cipher 'ALL:NULL'

This is requesting a cipher that neither authenticates nor encrypts. There
is just one cipher-suite that does that available with 0.9.8 and later:

$ openssl ciphers -v 'aNULL+eNULL'
AECDH-NULL-SHA  SSLv3 Kx=ECDH Au=None Enc=None  Mac=SHA1

This does anonymous elliptic curve DH key exchange, and provides integrity
(SHA1) with no encryption.

 The client is proposing the following ciphersuites:
 
   TLS_RSA_WITH_NULL_SHA
   TLS_RSA_WITH_NULL_MD5

The client is looking for RSA server certificates. It supports 'eNULL',
but not 'aNULL' ciphers.

 But the server does not like this at all :-( It always replies with
 
 20962:error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared
 cipher:s3_srvr.c:974:

The server is right.

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


RE: RSA_verify problem

2008-02-04 Thread Marek . Marcola
Hello,
 I am now consistently getting an error 0306E06C:bignum 
routines:BN_mod_inverse:no 
 inverse when calling RSA_verify. 
 
 I am still taking the following steps:
 
 1) Extracting the 'SignedInfo' node and creating a 20 byte SHA1 hash of 
the value of it 
 and its contents. I am confident this is working correctly because I use 
the same code 
 for calculating and comparing the DigestValues which is working fine.
 2) Extracting the 'Modulus' and 'Exponent' values and then Base64 
decoding both. This 
 creates a 128 byte modulus and 3 byte exponent.  I am also confident 
this is working 
 correctly because I am using the Base64 decoding/encoding code elsewhere 
without problems. 
 3) Extracting the 'SignatureValue' value and Base64 decoding it which 
creates a 128 bytesignature.
 4) Converting  (using BN_bin2bn) the Base64 decoded modulus and exponent 
values and 
 assigning them to a RSA structure (n and e) with a size of 128 and 3 
bytes respectively 
 i.e rsa_struct_ptr-n = BN_bin2bn(modulus, 128, NULL); rsa_struct_ptr-e 
= BN_bin2bn
 (exponent, 3, NULL); I am calling RSA_new() before I do this.
 5) Calling RSA_Verify with 'NID_sha1', the 20 byte hash  (from 1) above) 
, the 128 byte 
 signature value  (from 3) above) , a signature size of 128, and the 
previously populated
 RSA structure  (from 4) above). . 
 I have looked at the Modulus, Exponent, P, Q, DP, DQ, InverseQ and D 
values that are 
 created on the server before the signature is sent to the client. The 
Modulus and 
 Exponent values match those that are received on the client.
 Is there some step I am doing incorrectly or something I am still 
missing?
Modular inverse is calculated with private keys and with RSA blinding when 
CRT
is used and in modular exponentation. Only third case apply here. 
My proposition is to test this with steps.
First of all you should check if your public key decrypts correctly 
signature
and this signature looks good.
You should use RSA_public_decrypt() function and check output.
I've attached simple test program which may be adapted for this purpose.
As result you should get padded ASN1 structure.

Best regards,
--
Marek Marcola [EMAIL PROTECTED]



rsa_test13.c
Description: Binary data


RE: RSA_verify problem

2008-02-04 Thread Chris Brown
Hi thanks for the sample code you provided.

I have tested the sample code and it runs without error however I am still
using the default char N[], char E[] and msg[] values in the file.

I am unclear what steps I need to take to convert the Modulus and Exponent
strings from my XML into a format suitable for this function. In the code it
seems that the N and E values are hexadecimal- should this be the
hexadecimal conversion of my 128 byte base64 decoded modulus value from the
XML and the equivalent for the exponent?

Also should the 'msg[]' character array be the pure xml string of the
SignedInfo element?

Thank you for your continued help.

Chris
  

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, 5 February 2008 6:34 a.m.
To: openssl-users@openssl.org
Subject: RE: RSA_verify problem

Hello,
 I am now consistently getting an error 0306E06C:bignum
routines:BN_mod_inverse:no 
 inverse when calling RSA_verify. 
 
 I am still taking the following steps:
 
 1) Extracting the 'SignedInfo' node and creating a 20 byte SHA1 hash 
 of
the value of it 
 and its contents. I am confident this is working correctly because I 
 use
the same code 
 for calculating and comparing the DigestValues which is working fine.
 2) Extracting the 'Modulus' and 'Exponent' values and then Base64
decoding both. This 
 creates a 128 byte modulus and 3 byte exponent.  I am also confident
this is working 
 correctly because I am using the Base64 decoding/encoding code 
 elsewhere
without problems. 
 3) Extracting the 'SignatureValue' value and Base64 decoding it which
creates a 128 bytesignature.
 4) Converting  (using BN_bin2bn) the Base64 decoded modulus and 
 exponent
values and 
 assigning them to a RSA structure (n and e) with a size of 128 and 3
bytes respectively 
 i.e rsa_struct_ptr-n = BN_bin2bn(modulus, 128, NULL); 
 rsa_struct_ptr-e
= BN_bin2bn
 (exponent, 3, NULL); I am calling RSA_new() before I do this.
 5) Calling RSA_Verify with 'NID_sha1', the 20 byte hash  (from 1) 
 above)
, the 128 byte 
 signature value  (from 3) above) , a signature size of 128, and the
previously populated
 RSA structure  (from 4) above). . 
 I have looked at the Modulus, Exponent, P, Q, DP, DQ, InverseQ and D
values that are 
 created on the server before the signature is sent to the client. The
Modulus and 
 Exponent values match those that are received on the client.
 Is there some step I am doing incorrectly or something I am still
missing?
Modular inverse is calculated with private keys and with RSA blinding when
CRT is used and in modular exponentation. Only third case apply here. 
My proposition is to test this with steps.
First of all you should check if your public key decrypts correctly
signature and this signature looks good.
You should use RSA_public_decrypt() function and check output.
I've attached simple test program which may be adapted for this purpose.
As result you should get padded ASN1 structure.

Best regards,
--
Marek Marcola [EMAIL PROTECTED]




__ NOD32 2847 (20080204) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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


Re: Fwd: An OpenSSL server with NULL cipher support

2008-02-04 Thread Victor Duchovni
On Mon, Feb 04, 2008 at 08:28:04AM -0800, JCA wrote:

 OK, I found it. In case this helps somebody out there, the way it
 works for me is the following:
 
 The client is invoked as
 
 openssl s_client -connect 127.0.0.1:443 -cipher COMPLEMENTOFALL:aNULL
 
 and the server as
 
 openssl s_server -msg -accept 443 -nocert -cipher COMPLEMENTOFALL:aNULL
 
 With this, the server accepts the TLS_RSA_WITH_NULL_SHA ciphersuite
 without complaints.
 

Completely wrong.

Now, you are asking not for no encryption (eNULL) ciphers, but
rather ciphers without certificates (i.e. aNULL) ciphers. The correct
syntax is:

ALL+aNULL

not

COMPLEMENTOFALL:aNULL

The TLS_RSA_WITH_NULL_SHA is an eNULL cipher, it is not an aNULL cipher,
and it requires a server certificate. As you provide no server cert, only
the aNULL ciphers are used.

With OpenSSL 0.9.8, the ALL+aNULL definition yields:

ADH-AES256-SHA  SSLv3 Kx=DH   Au=None Enc=AES(256)  Mac=SHA1
ADH-AES128-SHA  SSLv3 Kx=DH   Au=None Enc=AES(128)  Mac=SHA1
ADH-DES-CBC3-SHASSLv3 Kx=DH   Au=None Enc=3DES(168) Mac=SHA1
ADH-DES-CBC-SHA SSLv3 Kx=DH   Au=None Enc=DES(56)   Mac=SHA1
EXP-ADH-DES-CBC-SHA SSLv3 Kx=DH(512)  Au=None Enc=DES(40)   Mac=SHA1 export
ADH-RC4-MD5 SSLv3 Kx=DH   Au=None Enc=RC4(128)  Mac=MD5
EXP-ADH-RC4-MD5 SSLv3 Kx=DH(512)  Au=None Enc=RC4(40)   Mac=MD5  export

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


Memory growth in OpenSSL socket server

2008-02-04 Thread ethrbunny

I have a simple server under WinXP that creates a thread for a 'listener' and
spins off a new thread for each incoming client. Im limiting access to one
client at a time at this point so it blocks on the listener until the client
is closed. 

Im using a self-signed certificate for the server. The client is (for now)
on the same machine and connects via Perl using IO::Socket::SSL.

Im watching the memory of the server using 'perfmon.exe' using the 'private
bytes' for the process. Im also watching via 'TaskMgr'.

The Perl code opens a connection, sends and then receives 3 different blocks
of data. The size ranges from 10 bytes to 1 bytes. The 'test' loops this
perl file with a second perl file that runs it, sleeps for 3 seconds and
then repeats. The data is the same each time.

What Im seeing: For the first three 'passes' the server memory grows by
about 10% each time and then stabilizes. From there it remains stable for
from 1-10 (~) passes and then grows by ~10%. Sometimes it will remain at
this new level sometimes it will return to the previous. If it remains at
either level it will do so for 1-10(~) passes and then jump up again. Ive
tested this for  3000 passes and have seen the same behavior repeating. 

It looks like some sort of buffer or cache is being filled and so more
memory is allocated. Nothing shows up as a memory leak though so someone is
freeing the space when the app exits. Unf this code will end up in a service
so there isn't a guarantee as to when the space will get freed. I will also
be sending vastly more information so the buffer problem will be a large
problem.

If I run the same code sans SSL it doesn't have this problem.

What I have tried:

(at SSL_ctx creation)
SSL_CTX_set_session_cache_mode(m_ctx, SSL_SESS_CACHE_OFF); 
SSL_CTX_sess_set_cache_size(m_ctx, 1);

(between each thread creation)
SSL_CTX_flush_sessions(ctx, 0); 

using:
OpenSSL 0.9.8g.
Visual Studio 7
Win XP
Perl 5.8.8

What am I missing? What am I doing wrong?


-- 
View this message in context: 
http://www.nabble.com/Memory-growth-in-OpenSSL-socket-server-tp15280493p15280493.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

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


Re: Compiling on a Mac

2008-02-04 Thread Joel Christner
Hi David,

I'm down to symbol not defined for one item - incremental_send (and I can't
find what file this is supposed to be in).

I re-installed to /usr/include/openssl and used --prefix=/usr/include and
--openssldir=/usr/include/openssl

I'm trying to compile now with -lssl -lcrypto -L/usr/include/openssl

I believe -lssl tried linking to a legacy version of openssl (I saw a thread
on this on the openssl website FAQ section).

I'm using the examples in the O'Reilly OpenSSL book.  I've attached the file
I'm using for your review.

Here's what I'm getting now when I try and compile - this appears to be the
only error.

Undefined symbols:
  _incremental_send, referenced from:
  _incremental_encrypt in cc4DdydW.o
  _incremental_finish in cc4DdydW.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Thanks for your help,
Joel



On Feb 4, 2008 10:52 AM, David Schwartz [EMAIL PROTECTED] wrote:


  Sorry I didn't update the list, but I tried with
  -lssl and -lcrypto, as well as -I/usr/include/openssl.

 And what happened? Did you get the same error messages or different ones?

  I've reinstalled openssl to no avail.

 What directories did you install to? And did you tell your compiler/linker
 to look in the right place?

  Any other thoughts?

 Typical include lines look like this:

 #include openssl/opensslconf.h

 So adding /usr/include/openssl to the includes will only help if you
 installed the opensslconf.h file as
 /usr/include/openssl/openssl/opensslconf.h which doesn't seem to make
 much
 sense.

 Also, what file did '-lssl' actually wind up linking to? Was it the file
 you
 installed or some other file, perhaps one that came with your system?

 DS


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

/*
 *
 *
 *
 *
 */

#include sys/types.h
#include sys/socket.h
#include stdio.h
#include arpa/inet.h
#include unistd.h
#include string.h
#include pthread.h
#include stdlib.h
#include netinet/in.h
#include netdb.h
#include time.h

#include openssl/evp.h
#include openssl/ssl.h
#include openssl/x509.h
#include openssl/x509v3.h
#include openssl/err.h
#include openssl/pem.h
#include openssl/rand.h
#include openssl/bio.h
#include openssl/objects.h

int seed_prng(int bytes)
{
  if (!RAND_load_file(/dev/random,bytes))
return 0;
  return 1;
}

void select_random_key(char *key,int b)
{
  int i;
  
  RAND_bytes(key,b);
  for (i=0; ib-1; i++) printf(%02X:,key[i]);
  printf(%02X\n,key[b-1]);
}

void select_random_iv(char *iv,int b)
{
  RAND_pseudo_bytes(iv,b);
}

int setup_for_encryption(void)
{
  EVP_CIPHER_CTX ctx;
  char key[EVP_MAX_KEY_LENGTH];
  char iv[EVP_MAX_IV_LENGTH];
  
  if (!seed_prng(512)) return 0;
  
  select_random_key(key,EVP_MAX_KEY_LENGTH);
  select_random_iv(iv,EVP_MAX_IV_LENGTH);
  EVP_EncryptInit(ctx,EVP_bf_cbc(),key,iv);
  return 1;
}

void setup_for_decryption(char *key,char *iv)
{
  EVP_CIPHER_CTX ctx;
  EVP_DecryptInit(ctx,EVP_bf_cbc(),key,iv);
}

char *encrypt_example(EVP_CIPHER_CTX *ctx,char *data,int inl,int *rb)
{
  char *ret;
  int i,tmp,ol;
  ol=0;
  ret=(char *)malloc(inl+EVP_CIPHER_CTX_block_size(ctx));
  for (i=0; iinl/100; i++) {
EVP_EncryptUpdate(ctx,ret[ol],tmp,data[ol],100);
ol+=tmp;
  }
  if (inl%100) {
EVP_EncryptUpdate(ctx,ret[ol],tmp,data[ol],inl%100);
ol+=tmp;
  }
  EVP_EncryptFinal(ctx,ret[ol],tmp);
  *rb=ol+tmp;
  return ret;
}

int incremental_encrypt(EVP_CIPHER_CTX *ctx,char *data,int inl)
{
  char *buf;
  int ol;
  int bl=EVP_CIPHER_CTX_block_size(ctx);
  buf=(char *)malloc((inl+bl-1)/bl*bl);
  EVP_EncryptUpdate(ctx,buf,ol,data,inl);
  if (ol) incremental_send(buf,ol);
  free(buf);
  return ol;
}

int incremental_finish(EVP_CIPHER_CTX *ctx)
{
  char *buf;
  int ol;
  buf=(char *)malloc(EVP_CIPHER_CTX_block_size(ctx));
  EVP_EncryptFinal(ctx,buf,ol);
  if (ol) incremental_send(buf,ol);
  free(buf);
  return ol;
}  

char *decrypt_example(EVP_CIPHER_CTX *ctx,char *ct,int inl)
{
  char *pt=(char *)malloc(inl+EVP_CIPHER_CTX_block_size(ctx)+1);
  int ol;
  EVP_DecryptUpdate(ctx,pt,ol,ct,inl);
  if (!ol) {
free(pt);
return NULL;
  }
  pt[ol]=0;
  return pt;
}

int main(int argc,char *argv[])
{
  EVP_CIPHER_CTX ctx;
  char key[EVP_MAX_KEY_LENGTH];
  char iv[EVP_MAX_IV_LENGTH];
  char *ct, *out;
  char final[EVP_MAX_BLOCK_LENGTH];
  char str[]=123456789abcdef;
  int i;
  
  if (!seed_prng(512)) {
printf(ERROR: Unable to seed the PRNG.\n);
abort();
  }
  
  select_random_key(key,EVP_MAX_KEY_LENGTH);
  select_random_iv(iv,EVP_MAX_IV_LENGTH);
  
  EVP_EncryptInit(ctx,EVP_bf_cbc(),key,iv);
  ct=encrypt_example(ctx,str,strlen(str),i);
  printf(Ciphertext: %d bytes\n,i);
  
  EVP_DecryptInit(ctx,EVP_bf_cbc(),key,iv);
  out=decrypt_example(ctx,ct,8);
  printf(Decrypted: %s\n,out);
  

Re: Sample code to connect to stunnel server

2008-02-04 Thread Alessandro Pivi - GLOBALcom engineering




You are right, now it works :-)

The stunnel should have been the server, but was configured as client.

Thankyou for your help.

[EMAIL PROTECTED] ha scritto:

  Hello,
  
  
I need to make an SSL connectione between a client and a server 
application, both developed by me.
On the server side I am going to use stunnel, while on the client side I 

  
  
  
  
can't use stunnel, I must use the ssl library.

I tried to write the code to do it, but I can't connect.
This is the output of stunnel:

2008.02.04 17:30:48 LOG7[6385:1077001280]: kstunnel accepted FD=6 from 
127.0.0.1:33208
2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel started
2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 6 in non-blocking mode
2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 7 in non-blocking mode
2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 8 in non-blocking mode
2008.02.04 17:30:48 LOG7[6385:1077070768]: Connection from 
127.0.0.1:33208 permitted by libwrap
2008.02.04 17:30:48 LOG5[6385:1077070768]: kstunnel connected from 
127.0.0.1:33208
2008.02.04 17:30:48 LOG7[6385:1077070768]: FD 7 in non-blocking mode
2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel connecting 
192.168.0.180:3000
2008.02.04 17:30:48 LOG7[6385:1077070768]: connect_wait: waiting 10 

  
  seconds
  
  
2008.02.04 17:30:48 LOG7[6385:1077070768]: connect_wait: connected
2008.02.04 17:30:48 LOG7[6385:1077070768]: Remote FD=7 initialized
2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL state (connect): 
before/connect initialization
2008.02.04 17:30:48 LOG7[6385:1077001280]: Cleaning up the signal pipe
2008.02.04 17:30:48 LOG6[6385:1077001280]: Child process 6550 finished 
with code 0
2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL state (connect): SSLv3 
write client hello A
2008.02.04 17:30:48 LOG7[6385:1077070768]: SSL alert (write): fatal: 
unexpected_message
2008.02.04 17:30:48 LOG3[6385:1077070768]: SSL_connect: 14092072: 
error:14092072:SSL routines:SSL3_GET_SERVER_HELLO:bad message type
2008.02.04 17:30:48 LOG5[6385:1077070768]: Connection reset: 0 bytes 
sent to SSL, 0 bytes sent to socket
2008.02.04 17:30:48 LOG7[6385:1077070768]: kstunnel finished (0 left)


I would like to know where to find sample C code to make an SSL 
connection to an stunnel server (better if with and without certificate 
verification).

  
  I do not know stunnel but from this messages this looks like this 
application
has bad configuration because it behaves like client - not server.
To be sure try to connect with:
$ openssl s_client -connect ip:port -debug -msg

Best regards,
--
Marek Marcola [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]