ssl + SOCK_SEQPACKET

2003-12-31 Thread Hannes Matuschek
Is it possible to use openssl with SOCK_SEQPACKET connections???

I tryed it, but ssl_accept and/or ssl_connect don't return in blocking mode
and booth want to read in non-blocking mode. 

Hannes Matuschek.

-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net


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


Howto add signed attributes in mails

2003-12-31 Thread Christian Weber
Dear OpenSSL user,

does anybody have a hint how to add a signed attribute during signing
with smime? Further: which OID should be taken to add a attribute like
siged on behalf of... or representing (a function).
In which order should that OID be added to the other signed attirbutes
(like signing time).
In which way should the api be used to extract signed attributes from
verfication process or during signing for visualization?
Using smime (source), are the singed attributes in the p7 structure?
How may we extraxt e.g. the signing time or the other signed attributes
as mentioned above?
Thanks for hints.
--
Christian Weber
mailto:[EMAIL PROTECTED]Tel: 02361/91300
For information on InfoTech visit http://www.InfoTech.de
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


FIPS Certification

2003-12-31 Thread Tal Mozes
Hi,

I just ran into this article
(http://www.gcn.com/vol1_no1/daily-updates/24504-1.html) which title is
OpenSSL gets FIPS certification. There was also a link to the article
on the last SANS NewsBites (Vol.5 Num.52, see http://portal.sans.org/).

From what I read in the websites of NIST and OSSI, this rumour is
greatly exaggerated. Could you give me an authoritative answer?

Thanks.

Tal Mozes

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


Re: Howto add signed attributes in mails

2003-12-31 Thread Dr. Stephen Henson
On Wed, Dec 31, 2003, Christian Weber wrote:

 Dear OpenSSL user,
 
 does anybody have a hint how to add a signed attribute during signing
 with smime? Further: which OID should be taken to add a attribute like
 siged on behalf of... or representing (a function).
 

You need to use the low level S/MIME API for this, check the source to
PKCS7_sign() which already adds some signed attributes (for S/MIME
capabilities).

You can use whatever OID you like because this is non standard, it should
however be from an OID tree you have access to rather than a made up OID. Just
don't expect any other software to recognize it.

Of course you shouldn't expect the attribute to mean anything much. Anyone who
known the OID could add whatever string they want: i.e. it wont in any secure
way say that someone is really authorized to sign on behalf of someone else.

 In which order should that OID be added to the other signed attirbutes
 (like signing time).
 

Any order, the ASN1 encoder will sort it out.

 In which way should the api be used to extract signed attributes from
 verfication process or during signing for visualization?
 Using smime (source), are the singed attributes in the p7 structure?
 How may we extraxt e.g. the signing time or the other signed attributes
 as mentioned above?
 

The attributes are in the PKCS7 structure specifically in the
PKCS7_SIGNER_INFO structure. You can use PKCS7_get_signed_attribute() to
retrieve them.

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 List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


Re: Occasional ssl23_read() failure

2003-12-31 Thread Dr. Stephen Henson
On Wed, Dec 31, 2003, Francis.Vanhemmens wrote:

 Well when you stay on F5 key, you force Internet Explorer to close the current 
 connections and recreate new ones. ( It may even multiply the number of simultaneous 
 connections as well. You can end up with 20 simultaneous connections for example, 
 instead of the normal 2 to 4 ones )
 
 Some maybe be some are closed during the handshake, and then you'll see some error 
 messages at server side, it just seems normal to me.
 
 I dont know s_server but i suppose it uses openssl with thread safety activated  btw.
 Be sure you did add the code needed to assume thread safety in openssl to your HTTPS 
 application.
 Without that you can also see such errors.
 

s_server is single threaded and will only accept one connection at a time.

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 List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


verify a signed file programmatically

2003-12-31 Thread Griff Miller
I sent this on the 23rd, but I haven't seen it show up yet in the archives.
Perhaps I have to actually be a member of the list to post (though the
information at http://www.openssl.org/support/ suggests otherwise) .
I just subscribed, and am posting again. So please forgive me if this
crops up twice.

...

I am trying to implement a simple software license key scheme. The idea is
to prevent the program in question from running unless an authentic license
file is present.

To ensure that the license file is authentic, I want to digitally sign it
with a private key. Then, of course, the application that reads the license
file must verify it with the public key.

Instead of using the openssl command via system(), popen(), or within a
wrapper script around my application (because that would be too easily
hacked) I want to put the signature verification code right into my
program's source. So I intend to insert the necessary calls to functions
in libcrypto.a into my source. Of course, this is still hackable by anyone
with a disassembler, but less so.

Reading the docs, it looks like I need to call RSA_verify .  That seems
easy enough, but it's getting set up to call RSA_verify that's slowing me
down. I don't know how to assemble the inputs to the function (indeed,
the RSA_verify manpage doesn't make it clear which args are input and
which are outputs).

I tried loading openssl into a debugger, and stepping through the code to
see what it does. One of the things it does that seems essential is to call
load_pubkey - but this seems to be a private interface. Hmm.

So, instead of me floundering around trying to figure out how to do this,
I was hoping that some kind soul could provide an example that I could work
off of. Can anyone help? It's step 5 of the procedure below that I am
trying to incorporate into my executable:

1) Set umask:

   umask 077

2) Create private key:

   openssl genrsa -des3 -out privkey.pem 2048

3) Extract the public key:

   openssl rsa -in privkey.pem -pubout -out pubkey.pem

4) Sign a file:

   openssl rsautl -sign -in /etc/hosts -inkey privkey.pem -out hosts.sig

5) Verify a file:

   openssl rsautl -verify -in hosts.sig -pubin -inkey pubkey.pem

-- 
Griff Miller II   | Why, I think I've got the hang of it now! |
Manager of Information Technology | :w :q :wq :wq! ^d X exit :quitbye :!QUIT! |
Positron Corporation  | CtrlAltDel ^E ^X ^I ^T ZZ q help ^X^C :~q |
[EMAIL PROTECTED] | ^Q ^U ^I ^T man vi $#^T$%WRGG~NO CARRIER |
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


Re: verify a signed file programmatically

2003-12-31 Thread Dr. Stephen Henson
On Wed, Dec 31, 2003, Griff Miller wrote:

 I sent this on the 23rd, but I haven't seen it show up yet in the archives.
 Perhaps I have to actually be a member of the list to post (though the
 information at http://www.openssl.org/support/ suggests otherwise) .
 I just subscribed, and am posting again. So please forgive me if this
 crops up twice.
 
 ...
 
 I am trying to implement a simple software license key scheme. The idea is
 to prevent the program in question from running unless an authentic license
 file is present.
 
 To ensure that the license file is authentic, I want to digitally sign it
 with a private key. Then, of course, the application that reads the license
 file must verify it with the public key.
 
 Instead of using the openssl command via system(), popen(), or within a
 wrapper script around my application (because that would be too easily
 hacked) I want to put the signature verification code right into my
 program's source. So I intend to insert the necessary calls to functions
 in libcrypto.a into my source. Of course, this is still hackable by anyone
 with a disassembler, but less so.
 
 Reading the docs, it looks like I need to call RSA_verify .  That seems
 easy enough, but it's getting set up to call RSA_verify that's slowing me
 down. I don't know how to assemble the inputs to the function (indeed,
 the RSA_verify manpage doesn't make it clear which args are input and
 which are outputs).
 
 I tried loading openssl into a debugger, and stepping through the code to
 see what it does. One of the things it does that seems essential is to call
 load_pubkey - but this seems to be a private interface. Hmm.
 
 So, instead of me floundering around trying to figure out how to do this,
 I was hoping that some kind soul could provide an example that I could work
 off of. Can anyone help? It's step 5 of the procedure below that I am
 trying to incorporate into my executable:
 
 1) Set umask:
 
umask 077
 
 2) Create private key:
 
openssl genrsa -des3 -out privkey.pem 2048
 
 3) Extract the public key:
 
openssl rsa -in privkey.pem -pubout -out pubkey.pem
 
 4) Sign a file:
 
openssl rsautl -sign -in /etc/hosts -inkey privkey.pem -out hosts.sig
 
 5) Verify a file:
 
openssl rsautl -verify -in hosts.sig -pubin -inkey pubkey.pem
 

As you've no doubt realised such license schemes are not very secure. A few
well placed NOPs will circumvent many of them. Equally replacing the public
key with a known one would also work. The code can be obfuscated and called at
various times but it is at best security by obscurity.

If you really want to do things that way then you should sign a digest using
the documented EVP_Sign*() functions. The dgst command can use them for
signing.

As for step 5 well this is just loading a public key into a EVP_PKEY
structure. This has been asked and answered several times. In outline:

1. Convert public key to DER.
2. Convert binary DER file to a C structure using xxd.
3. Convert public key to EVP_PKEY structure using d2i_PUBKEY().

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 List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


Re: ssl + SOCK_SEQPACKET

2003-12-31 Thread Ng Pheng Siong
On Wed, Dec 31, 2003 at 10:52:31AM +0100, Hannes Matuschek wrote:
 Is it possible to use openssl with SOCK_SEQPACKET connections???

Why, if one may ask?

 I tryed it, but ssl_accept and/or ssl_connect don't return in blocking mode
 and booth want to read in non-blocking mode. 

FreeBSD socket manpage says:

  SOCK_SEQPACKET socket may provide a sequenced, reliable, two-way connec-
  tion-based data transmission path for datagrams of fixed maximum length;
  a consumer may be required to read an entire packet with each read system
  call.

What does your manpage/source say about it?

You may want to try the socket-distinct-from-SSL-state-machine approach.

Cheers.
-- 
Ng Pheng Siong [EMAIL PROTECTED] 

http://firewall.rulemaker.net -+- Firewall Change Management  Version Control
http://sandbox.rulemaker.net/ngps -+- Open Source Python Crypto  SSL
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


Re: verify a signed file programmatically

2003-12-31 Thread Griff Miller
Dr. Stephen Henson wrote:
 
 As you've no doubt realised such license schemes are not very secure.

Right, but it's going to be a lot better than nothing.  :)

 A few well placed NOPs will circumvent many of them.

This seems to be the main weakness in just about any license key scheme,
i.e. hacking the binary to do whatever you want.

 Equally replacing the public
 key with a known one would also work.

Well, I intend to have the public key embedded in the code, not in a file
that the user can toy with. Of course, that's susceptible to binary hacking
as well.

 The code can be obfuscated and called at
 various times but it is at best security by obscurity.

Again, it's better than what I've got now - nothing. If you have in mind
different methods I should be trying, I'm all ears.

 If you really want to do things that way then you should sign a digest using
 the documented EVP_Sign*() functions. The dgst command can use them for
 signing.

OK, I'll take a look at those. One thing I like about that is that
I can have a cleartext license file. The way I was experimenting with
it caused me to have a license file that was human-unreadable.

 As for step 5 well this is just loading a public key into a EVP_PKEY
 structure. This has been asked and answered several times. In outline:
 
 1. Convert public key to DER.
 2. Convert binary DER file to a C structure using xxd.
 3. Convert public key to EVP_PKEY structure using d2i_PUBKEY().

OK, I'll dig around for some coding examples.

Thanks!

-- 
Griff Miller II   |   |
Manager of Information Technology | This space has been blankly  |
Positron Corporation  |  left intentional.   |
[EMAIL PROTECTED] |   |
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]


Re: FIPS Certification

2003-12-31 Thread Ben Laurie
Tal Mozes wrote:

Hi,

I just ran into this article
(http://www.gcn.com/vol1_no1/daily-updates/24504-1.html) which title is
OpenSSL gets FIPS certification. There was also a link to the article
on the last SANS NewsBites (Vol.5 Num.52, see http://portal.sans.org/).
From what I read in the websites of NIST and OSSI, this rumour is
greatly exaggerated. Could you give me an authoritative answer?
We are in the process of getting certification. The process is not yet 
complete.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html   http://www.thebunker.net/
There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit. - Robert Woodruff
__
OpenSSL Project http://www.openssl.org
User Support Mailing List[EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]