Re: X509 Certificate : Need help to retrieve Extended Key Usage filed from the certificate

2012-07-27 Thread Puneet Khunteta
any Update ?

regards,
Puneet

On Thu, Jul 26, 2012 at 4:27 PM, Puneet Khunteta
khunteta.pun...@gmail.comwrote:

 Hello Stephen,

 On using the suggestion provided by you , got the following output snippet


 It shows extusage-data Empty.

 Regards,
 Puneet

 On Wed, Jul 25, 2012 at 4:01 PM, Dr. Stephen Henson st...@openssl.orgwrote:

 On Wed, Jul 25, 2012, Puneet Khunteta wrote:

  Hello,
 
  I am an user of openssl library.
  I am seeking for a method to get the Extended Key Usage field from the
  X509 certificate .
  I will be grateful if you can provide me a sample code in c.
 

 You can retrieve a structure representing any supported extension using
 the
 function X509_get_ext_d2i. In the case of EKU you get back a
 STACK_OF(ASN1_OBJECT) which you can then examine.

 Have a look in the function x509v3_cache_extension in
 crypto/x509v3/v3_purp.c
 for an example.

 Steve.
 --
 Dr Stephen N. Henson. OpenSSL project core developer.
 Commercial tech support now available see: http://www.openssl.org
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   majord...@openssl.org





Re: Blowfish and key length

2012-07-27 Thread Cristiano Toninato

Il 26/07/2012 23.11, Dr. Stephen Henson ha scritto:

On Thu, Jul 26, 2012, Cristiano Toninato wrote:


This simple test program should print always the same result, but
with openSSL 0.9.8o and gcc 4.5.2 output is

 From http://www.schneier.com/code/vectors.txt, cipher bytes should
be 51866FD5B85ECB8A
Test BF_ecb_encrypt(): 51866FD5B85ECB8A
Test EVP_bf_ecb(): 5AACFB5A8DC0155D
Test EVP_bf_ecb() with 128 bit key: 5AACFB5A8DC0155D

as if EVP_CIPHER_CTX_set_key_length had no effect.
I searched with google if anyone had similar problem, but I found
only
http://www.mail-archive.com/openssl-users@openssl.org/msg25808.html,
and the discussion ends without useful information.
I suspect something in my code being wrong, but I cannot understand what.

You need to make two call to EVP_EncryptInit_ex etc if you want a non-default
key length. Check out the examples in the manual page:

http://www.openssl.org/docs/crypto/EVP_EncryptInit.html

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org

Really sorry. I did try calling twice EVP_EncryptInit_ex, but I set also 
const EVP_CIPHER * parameter.

Now it works, thank you all my life.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


RE: Using Self-Signed Certificates to create SSL connection.

2012-07-27 Thread Hasan, Rezaul (NSN - US/Arlington Heights)
Great. Thank You  :-)


-Original Message-
From: owner-openssl-us...@openssl.org
[mailto:owner-openssl-us...@openssl.org] On Behalf Of ext Dave Thompson
Sent: Thursday, July 26, 2012 5:49 PM
To: openssl-users@openssl.org
Subject: RE: Using Self-Signed Certificates to create SSL connection.

From: owner-openssl-us...@openssl.org On Behalf Of Hasan, Rezaul (NSN -
US/Arlington Heights)
Sent: Thursday, 26 July, 2012 12:02

I have created a self-signed CA certificate, a Client certificate and a

Server certificate. I signed the Client and Server certificates with 
the self-signed CA certificate and placed all certs in the appropriate 
locations. Then attempted to create an SSL connection with 
'openssl s_client ..' ,  and get  this 
Verify return code: 19 (self signed certificate in certificate chain)

Is this an error indicating that the SSL connection failed, or is it
simply

a warning ? I am guessing its just a warning, but wanted to confirm.

For s_client, it's a warning. s_client overrides verify errors and 
allows you to continue. Most real apps don't do this and shouldn't, 
so for real apps this will probably be fatal.

... -cert client.crt -key client.key -CApath /root/CERT

Did you put your CA cert in /root/CERT with a symlink from
$subjecthash.$seq, 
or if you prefer directly under that name? If not, OpenSSL won't find
it.

Alternatively, use -CAfile with all your roots (perhaps only one) in a
file.


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


Tls1.2 Problem with client certificate and RSA_verify

2012-07-27 Thread Albers, Thorsten
Hi,
I have a problem with the openssl s_server (v1.0.1c) when requesting a client 
certificate. I'm developing my own TLS 1.2 implementation (for embedded 
platforms), and I'm stuck with a problem with using the client certificate. I 
already implemented TLS 1.0 earlier, so it's not completely new for me, and it 
worked fine even with client certificates.
My current implementation can handle TLS 1.2 handshakes without client 
authentication, as well as TLS 1.0 with or without client authentication. When 
I try to connect to the openssl server, the handshake goes as far as the client 
having sent its messages up to (including)  'change cipher spec'. But then the 
server sends an alarm (decrypt error). The openssl server console tells me some 
strange error:

ACCEPT
bad gethostbyaddr
depth=1 CN = TestAndDevRootAuthority
verify return:1
depth=0 CN = MyClient
verify return:1
1696:error:0D07209B:asn1 encoding routines:ASN1_get_object:too 
long:.\crypto\asn1\asn1_lib.c:142:
1696:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object 
header:.\crypto\asn1\tasn_dec.c:1306:
1696:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 
error:.\crypto\asn1\tasn_dec.c:381:Type=X509_SIG

1696:error:1408807B:SSL routines:SSL3_GET_CERT_VERIFY:bad 
signature:.\ssl\s3_srvr.c:3049:
1696:error:140780E5:SSL routines:SSL23_READ:ssl handshake 
failure:.\ssl\s23_lib.c:131:
ACCEPT

I'm most confused by the ASN1 errors. I debugged the openssl server beginning 
at the function ssl3_get_cert_verify() and through some functions to 
pkey_rsa_verify(). Here I found a call of RSA_verify() that never called this 
function but always called CMS_RecipientInfo_type(). That seems to be so wrong, 
and I don't understand why this function call is misguided. Why does is call 
the wrong function? Any ideas?

I build the openssl.exe using the batch file to build openssl with Visual 
Studio 2010.

I'd be pleased for any hint.
Regards,
Thorsten Albers



RE: Tls1.2 Problem with client certificate and RSA_verify

2012-07-27 Thread Philippe Lhardy
Hi,

An idea out of nowhere : did you investigate the bad gethostbyaddr issue ?
There is reverse DNS done. how is your reverse dns set ? can you enter you host 
in hosts and see if does help ?

Regards,


From: owner-openssl-us...@openssl.org [owner-openssl-us...@openssl.org] on 
behalf of Albers, Thorsten [thorsten.alb...@vector.com]
Sent: Friday, July 27, 2012 1:11 PM
To: openssl-users@openssl.org
Subject: Tls1.2 Problem with client certificate and RSA_verify

Hi,
I have a problem with the openssl s_server (v1.0.1c) when requesting a client 
certificate. I’m developing my own TLS 1.2 implementation (for embedded 
platforms), and I’m stuck with a problem with using the client certificate. I 
already implemented TLS 1.0 earlier, so it’s not completely new for me, and it 
worked fine even with client certificates.
My current implementation can handle TLS 1.2 handshakes without client 
authentication, as well as TLS 1.0 with or without client authentication. When 
I try to connect to the openssl server, the handshake goes as far as the client 
having sent its messages up to (including)  ‘change cipher spec’. But then the 
server sends an alarm (decrypt error). The openssl server console tells me some 
strange error:

ACCEPT
bad gethostbyaddr
depth=1 CN = TestAndDevRootAuthority
verify return:1
depth=0 CN = MyClient
verify return:1
1696:error:0D07209B:asn1 encoding routines:ASN1_get_object:too 
long:.\crypto\asn1\asn1_lib.c:142:
1696:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object 
header:.\crypto\asn1\tasn_dec.c:1306:
1696:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 
error:.\crypto\asn1\tasn_dec.c:381:Type=X509_SIG

1696:error:1408807B:SSL routines:SSL3_GET_CERT_VERIFY:bad 
signature:.\ssl\s3_srvr.c:3049:
1696:error:140780E5:SSL routines:SSL23_READ:ssl handshake 
failure:.\ssl\s23_lib.c:131:
ACCEPT

I’m most confused by the ASN1 errors. I debugged the openssl server beginning 
at the function ssl3_get_cert_verify() and through some functions to 
pkey_rsa_verify(). Here I found a call of RSA_verify() that never called this 
function but always called CMS_RecipientInfo_type(). That seems to be so wrong, 
and I don’t understand why this function call is misguided. Why does is call 
the wrong function? Any ideas?

I build the openssl.exe using the batch file to build openssl with Visual 
Studio 2010.

I’d be pleased for any hint.
Regards,
Thorsten Albers



Re: create certificate request programmatically using OpenSSL API

2012-07-27 Thread Abyss Lingvo
Hi all! 


The
last problem is how to create GOST key pair for certificate.
It is
clear how to create RSA keys.
Sample
is here : http://www.openssl.org/docs/crypto/EVP_PKEY_keygen.html
 
 #include openssl/evp.h
 #include openssl/rsa.h
 EVP_PKEY_CTX *ctx;
 EVP_PKEY *pkey = NULL;
 ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
 if (!ctx)
    /* Error occurred */
 if (EVP_PKEY_keygen_init(ctx) = 0)
    /* Error */
 if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx,
2048) = 0)
    /* Error */
 /* Generate key */
 if (EVP_PKEY_keygen(ctx, pkey) = 0)
      /* Error */
 
Unfortunately
there is no EVP_PKEY_GOST constant and I can't create EVP_PKEY containing GOST
key pair.
 
Does
anybody know how to create GOST key pair? 
 
Best Regards


Porting OpenSSL to andorid platform

2012-07-27 Thread Bibhudatta Biswal
Hi,

We are planning to integrate OpenSSL to our VoIP product to secure Voice and 
Signaling. Our VoIP products runs on multiple platforms like Android, Iphone, 
Windows, Windows Mobile, Nucleus etc. I want to know the list of things that I 
need to take care to generate the OpenSSL static library for the above 
mentioned platforms.

Thanks  Regards,
Bibhu


Re: Certificate and Certificate request (Using API)

2012-07-27 Thread Saurabh Pandya
On 7/27/12, Saurabh Pandya er.saurabhpan...@gmail.com wrote:
 Do roughly the same thing apps/ca.c does, except you probably don't
 need all its options but may want some other options:

 Create an X509 and set all needed X509_CINF fields in that X509
 to values that you either extract from the X509_REQ and approve,
 or choose by your own logic (serial at least). Then sign the X509.

 Using My self-signed CA's private key, isn't it ??

I am asking this as I have the basic question about certificate signing

  - I have my self-sign CA A and CA key file B
  - I create another RSA key pair EVP_PKEY *pkey to be used for
child leaf certificates
  - I create a certificate X509 *x (that supposed to be child of my CA)
  I am setting public key by, that will set public key
part of rsa key pkey, to my certificate x
  X509_set_pubkey(x,pkey)
  And I am signing certificate with my private key
  x509_sign(x,pkey)

  Then How can I make my normal server certificate x as a child of
  my CA certificate A, do i need to sign it with B.

  I am confuse which keys to set in X509_set_pubkey() and  X509_sign
  when I want a certificate appeared to be issued by my CA.

Thanks all.
Saurabh
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: Porting OpenSSL to andorid platform

2012-07-27 Thread Jason Goldberg
For Android, you'll need to download the Android NDK toolchain and then pull 
down this project:

https://github.com/eighthave/openssl-android

Use NDK to build the project above and that will generate the .so files you can 
link to.

For iOS, check out:

https://github.com/x2on/OpenSSL-for-iPhone

That will build you Mach-format libs containing i386, armv6 and armv7 object 
code which you can link to.  Then just add libssl and libcrypt to your project 
and include the OpenSSL headers directory.

Jason

On Jul 26, 2012, at 11:19 PM, Bibhudatta Biswal 
bbi...@kodiaknetworks.commailto:bbi...@kodiaknetworks.com
 wrote:

Hi,

We are planning to integrate OpenSSL to our VoIP product to secure Voice and 
Signaling. Our VoIP products runs on multiple platforms like Android, Iphone, 
Windows, Windows Mobile, Nucleus etc. I want to know the list of things that I 
need to take care to generate the OpenSSL static library for the above 
mentioned platforms.

Thanks  Regards,
Bibhu



Re: Certificate and Certificate request (Using API)

2012-07-27 Thread Sanford Staab
It really looks to me like the openssl documentation needs improvement as 
well as a better tool besides CA.pl to help people use openssl in common 
scenarios.   I suspect there is a strong demand for creative private CA 
support and we should have a friendly script or cookbook for this available 
somewhere.  Fixing this will relieve you guys of answering all these 
inquiries via email.
If any of the devs on openssl would like some help on writing up or coding 
up some docs/tools to help this process I would be happy to help where I 
can.  I am a windows guy and have very little experience with Unix systems 
so that is where I would be of more help.  I too am new to openssl and am 
trying to do these same kinds of things and have not yet been comfortable 
with my knowledge to embark on extensive coding.  Let me know if and how I 
can help.


Sandy

-Original Message- 
From: Saurabh Pandya

Sent: Friday, July 27, 2012 7:20 AM
To: openssl-users@openssl.org
Subject: Re: Certificate and Certificate request (Using API)

On 7/27/12, Saurabh Pandya er.saurabhpan...@gmail.com wrote:

Do roughly the same thing apps/ca.c does, except you probably don't
need all its options but may want some other options:

Create an X509 and set all needed X509_CINF fields in that X509
to values that you either extract from the X509_REQ and approve,
or choose by your own logic (serial at least). Then sign the X509.


Using My self-signed CA's private key, isn't it ??


I am asking this as I have the basic question about certificate signing

 - I have my self-sign CA A and CA key file B
 - I create another RSA key pair EVP_PKEY *pkey to be used for
child leaf certificates
 - I create a certificate X509 *x (that supposed to be child of my 
CA)

 I am setting public key by, that will set public key
part of rsa key pkey, to my certificate x
 X509_set_pubkey(x,pkey)
 And I am signing certificate with my private key
 x509_sign(x,pkey)

 Then How can I make my normal server certificate x as a child of
 my CA certificate A, do i need to sign it with B.

 I am confuse which keys to set in X509_set_pubkey() and  X509_sign
 when I want a certificate appeared to be issued by my CA.

Thanks all.
Saurabh
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org 


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


RE: Help with client certificates

2012-07-27 Thread Fili, Tom
That is very helpful. So it looks like there are 2 options, either
selecting the first certificate or using the dialog.

If looks like there is a callback (client_cert_select) on the CAPI_CTX,
which you can get from ENGINE_get_ex_data if you know the index (which
seems to be static to the e_capi.c file). Is there an clean way to what
I want or do I have to hack it and look at the engine-ex_data-sk and
make a guess at it?


Thomas Fili

-Original Message-
From: owner-openssl-us...@openssl.org
[mailto:owner-openssl-us...@openssl.org] On Behalf Of Dr. Stephen Henson
Sent: Thursday, July 26, 2012 6:42 PM
To: openssl-users@openssl.org
Subject: Re: Help with client certificates

On Wed, Jul 25, 2012, Fili, Tom wrote:

 I'm trying to setup my application to allow for the use of client 
 certificates. I am using the capi engine to pull from the Windows
store.
 
 I setup my ssl connection and it works fine if I set the correct 
 certificate using SSL_CTX_use_certificate_ASN1  
 ENGINE_load_private_key.
 
 From what I've read, in the SSL handshake where client certificates 
 are
 required, the server actually sends back a list of CAs that it
accepts.
 Is there something I can do after SSL_do_handshake or something I can 
 do in place of it to get that list of CAs, so I can filter the list I 
 display to the user (similar to the certificate dialogs you see in a 
 browser).
 

There is an automatic client certificate selection feature in the capi
ENGINE.
You just pass the ENGINE parameter to SSL_CTX_set_client_cert_engine. If
OpenSSL is compiled with the OPENSSL_CAPIENG_DIALOG it will also display
a dialog box.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: Tls1.2 Problem with client certificate and RSA_verify

2012-07-27 Thread Dr. Stephen Henson
On Fri, Jul 27, 2012, Albers, Thorsten wrote:

 Hi,
 I have a problem with the openssl s_server (v1.0.1c) when requesting a client 
 certificate. I'm developing my own TLS 1.2 implementation (for embedded 
 platforms), and I'm stuck with a problem with using the client certificate. I 
 already implemented TLS 1.0 earlier, so it's not completely new for me, and 
 it worked fine even with client certificates.
 My current implementation can handle TLS 1.2 handshakes without client 
 authentication, as well as TLS 1.0 with or without client authentication. 
 When I try to connect to the openssl server, the handshake goes as far as the 
 client having sent its messages up to (including)  'change cipher spec'. But 
 then the server sends an alarm (decrypt error). The openssl server console 
 tells me some strange error:
 
 ACCEPT
 bad gethostbyaddr
 depth=1 CN = TestAndDevRootAuthority
 verify return:1
 depth=0 CN = MyClient
 verify return:1
 1696:error:0D07209B:asn1 encoding routines:ASN1_get_object:too 
 long:.\crypto\asn1\asn1_lib.c:142:
 1696:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object 
 header:.\crypto\asn1\tasn_dec.c:1306:
 1696:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 
 error:.\crypto\asn1\tasn_dec.c:381:Type=X509_SIG
 
 1696:error:1408807B:SSL routines:SSL3_GET_CERT_VERIFY:bad 
 signature:.\ssl\s3_srvr.c:3049:
 1696:error:140780E5:SSL routines:SSL23_READ:ssl handshake 
 failure:.\ssl\s23_lib.c:131:
 ACCEPT
 

For previous versions of TLS the signature for RSA is a raw MD5+SHA1
concatenation. For TLS 1.2 it is the DigestInfo structure instead using
whatever digest is appropriate. That error looks like OpenSSL is trying to
interpret an MD5+SHA1 signature as a DigestInfo and choking on it.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: fingerprint does not match on FIPS_mode_set when FIPS + openssl is dynamically linked into build

2012-07-27 Thread Cassie Helms
Cassie Helms cassie.helms@... writes:

 Built fips_algvs on build system and scp'd to target system as suggested. 

Hmm. I incorporated building fips_algvs into my build system and ran it from 
the 
rpm install on the target machine. I get different results now -- can anyone 
point to what this might indicate, coupled with the fips fingerprint error?

# fips_algvs fips_test_suite post

FIPS-mode test application
FIPS 2.0 validated module 14 Mar 2012

DRBG AES-256-CTR DF test started
DRBG AES-256-CTR DF test OK
POST started
Integrity  test started
ERROR:2D06B06F:lib=45,func=107,reason=111:file=fips.c:line=229
Integrity  test Failed Incorrectly!!
DRBG AES-256-CTR DF test started
DRBG AES-256-CTR DF test OK
DRBG AES-256-CTR test started
DRBG AES-256-CTR test OK
DRBG SHA256 test started
DRBG SHA256 test OK
DRBG HMAC-SHA256 test started
DRBG HMAC-SHA256 test OK
DRBG P-256 SHA256 test started
DRBG P-256 SHA256 test OK
X9.31 PRNG keylen=16 test started
X9.31 PRNG keylen=16 test OK
X9.31 PRNG keylen=24 test started
X9.31 PRNG keylen=24 test OK
X9.31 PRNG keylen=32 test started
X9.31 PRNG keylen=32 test OK
Digest SHA1 test started
Digest SHA1 test OK
Digest SHA1 test started
Digest SHA1 test OK
Digest SHA1 test started
Digest SHA1 test OK
HMAC SHA1 test started
HMAC SHA1 test OK
HMAC SHA224 test started
HMAC SHA224 test OK
HMAC SHA256 test started
HMAC SHA256 test OK
HMAC SHA384 test started
HMAC SHA384 test OK
HMAC SHA512 test started
HMAC SHA512 test OK
CMAC AES-128-CBC test started
CMAC AES-128-CBC test OK
CMAC AES-192-CBC test started
CMAC AES-192-CBC test OK
CMAC AES-256-CBC test started
CMAC AES-256-CBC test OK
CMAC DES-EDE3-CBC test started
CMAC DES-EDE3-CBC test OK
Cipher AES-128-ECB test started
Cipher AES-128-ECB test OK
CCM  test started
CCM  test OK
GCM  test started
GCM  test OK
XTS AES-128-XTS test started
XTS AES-128-XTS test OK
XTS AES-256-XTS test started
XTS AES-256-XTS test OK
Cipher DES-EDE3-ECB test started
Cipher DES-EDE3-ECB test OK
Cipher DES-EDE3-ECB test started
Cipher DES-EDE3-ECB test OK
Signature RSA test started
Signature RSA test OK
Signature ECDSA P-224 test started
Signature ECDSA P-224 test OK
Signature ECDSA K-233 test started
Signature ECDSA K-233 test OK
Signature DSA test started
Signature DSA test OK
ECDH P-224 test started
ECDH P-224 test OK
POST Failed
Power-up self test failed

Old results below --

 ./fips_algvs fips_test_suite post
   FIPS-mode test application
   FIPS 2.0 validated module 14 Mar 2012
 
   DRBG AES-256-CTR DF test started
   DRBG AES-256-CTR DF test OK
   POST started
   Integrity  test started
   Integrity  test OK
   DRBG AES-256-CTR DF test started
   DRBG AES-256-CTR DF test OK
   DRBG AES-256-CTR test started
   DRBG AES-256-CTR test OK
   DRBG SHA256 test started
   DRBG SHA256 test OK
   DRBG HMAC-SHA256 test started
   DRBG HMAC-SHA256 test OK
   DRBG P-256 SHA256 test started
   DRBG P-256 SHA256 test OK
   X9.31 PRNG keylen=16 test started
   X9.31 PRNG keylen=16 test OK
   X9.31 PRNG keylen=24 test started
   X9.31 PRNG keylen=24 test OK
   X9.31 PRNG keylen=32 test started
   X9.31 PRNG keylen=32 test OK
   Digest SHA1 test started
   Digest SHA1 test OK
   Digest SHA1 test started
   Digest SHA1 test OK
   Digest SHA1 test started
   Digest SHA1 test OK
   HMAC SHA1 test started
   HMAC SHA1 test OK
   HMAC SHA224 test started
   HMAC SHA224 test OK
   HMAC SHA256 test started
   HMAC SHA256 test OK
   HMAC SHA384 test started
   

Re: fingerprint does not match on FIPS_mode_set when FIPS + openssl is dynamically linked into build

2012-07-27 Thread Dr. Stephen Henson
On Fri, Jul 27, 2012, Cassie Helms wrote:

 Cassie Helms cassie.helms@... writes:
 
  Built fips_algvs on build system and scp'd to target system as suggested. 
 
 Hmm. I incorporated building fips_algvs into my build system and ran it from 
 the 
 rpm install on the target machine. I get different results now -- can anyone 
 point to what this might indicate, coupled with the fips fingerprint error?
 
 # fips_algvs fips_test_suite post
 
   FIPS-mode test application
   FIPS 2.0 validated module 14 Mar 2012
 
   DRBG AES-256-CTR DF test started
   DRBG AES-256-CTR DF test OK
   POST started
   Integrity  test started
 ERROR:2D06B06F:lib=45,func=107,reason=111:file=fips.c:line=229
   Integrity  test Failed Incorrectly!!

Well that error indicates the fingerprint error. The question is what is
different about the two build processes?

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: X509 Certificate : Need help to retrieve Extended Key Usage filed from the certificate

2012-07-27 Thread Dr. Stephen Henson
On Fri, Jul 27, 2012, Puneet Khunteta wrote:

 any Update ?
 
 regards,
 Puneet
 
 On Thu, Jul 26, 2012 at 4:27 PM, Puneet Khunteta
 khunteta.pun...@gmail.comwrote:
 
  Hello Stephen,
 
  On using the suggestion provided by you , got the following output snippet
 
 
  It shows extusage-data Empty.
 

It's not clear what you are doing. You should get back a STACK_OF(ASN1_OBJECT)
and examine it with sk_ASN1_OBJECT_num(extusage) and
sk_ASN1_OBJECT_value(extusage, index).

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: fingerprint does not match on FIPS_mode_set when FIPS + openssl is dynamically linked into build

2012-07-27 Thread Cassie Helms
Dr. Stephen Henson steve@... writes:

  Integrity  test started
  ERROR:2D06B06F:lib=45,func=107,reason=111:file=fips.c:line=229
  Integrity  test Failed Incorrectly!!
 
 Well that error indicates the fingerprint error. The question is what is
 different about the two build processes?

The difference seems to be in the sequence of building things. In the main 
build, I do

1. fipscanister.o
2. fips_algvs
3. openssl + fipscanister.o module

If I use the copy of fips_algvs tool generated in step 2, I get the error on 
the 
target system.

The build is set up such that I have source and build output leftover in debug 
directories. If I go back manually to the debugging source for fips and do a 
make build_algvs, like so

4. fips_algvs

and use that copy of the tool, no error comes out on the target system.

Much head scratching. And I still don't know what digests are getting 
compared 
during this FIPS_mode_set step. What is an incore fingerprint anyway?

Cassie


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


Configuration files always required?

2012-07-27 Thread Tom Browder
I am working on a Perl programmatic solution (i.e., no user responses
needed) to a local CA and wonder if I need any configuration files at
all?  So far, all the man pages I've looked at seem to have command
args to handle almost everything that seems important (i.e.,
required).

The one exception I've found so far may be the [ req ] section that has:

  prompt  = no

Thanks.

Best regards,

-Tom
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


RSA PRIVATE KEY, CERTIFICATE REQUEST, and CERTIFICATE

2012-07-27 Thread Rita Rex Smith
I am just getting started trying to figure out how to set up an SSL
certificate and key with PayPal to use for encrypted payments on my website.
I am totally confused as to what I need to upload to them and how to figure
out if it is correct or not.

I am familiar with programming, but I am having a lot of trouble figuring
this out.  I would appreciate your help!

Thanks!
Rita Smith
ritarexsm...@gmail.com




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


RE: Certificate and Certificate request (Using API)

2012-07-27 Thread Dave Thompson
 From: owner-openssl-us...@openssl.org On Behalf Of Saurabh Pandya
 Sent: Friday, 27 July, 2012 10:21

 On 7/27/12, Saurabh Pandya er.saurabhpan...@gmail.com wrote:
  Do roughly the same thing apps/ca.c does, except you probably don't
  need all its options but may want some other options:
 
  Create an X509 and set all needed X509_CINF fields in that X509
  to values that you either extract from the X509_REQ and approve,
  or choose by your own logic (serial at least). Then sign the X509.
 
  Using My self-signed CA's private key, isn't it ??
 
Yes. See below.

 I am asking this as I have the basic question about 
 certificate signing
 
   - I have my self-sign CA A and CA key file B

I assume that's CA-cert file A and CA-key file B

   - I create another RSA key pair EVP_PKEY *pkey to be used for
 child leaf certificates
   - I create a certificate X509 *x (that supposed to 
 be child of my CA)
   I am setting public key by, that will set public key
 part of rsa key pkey, to my certificate x
   X509_set_pubkey(x,pkey)
   And I am signing certificate with my private key
   x509_sign(x,pkey)
 
No. That makes the child self-signed, not signed by the CA.

   Then How can I make my normal server certificate 
 x as a child of
   my CA certificate A, do i need to sign it with B.
 
   I am confuse which keys to set in X509_set_pubkey() 
 and  X509_sign
   when I want a certificate appeared to be issued by my CA.
 
X509_set_pubkey to (public part of) child's key (pkey)
X509_set_subject_name to name of the child 
X509_set_issuer_name to name of the CA, specifically 
  X509_get_subject_name from the CA-cert in file A.
X509_set_serialNumber to a unique value you choose 
  (some CA's use actual serial numbers 1,2,3,... but most 
  nowadays use an obscured or totally random sequence)
X509_set_notBefore,notAfter as desired (usually notBefore=now 
  notAfter=now plus some interval like 3 months, 1 year, etc.)
X509_set_version depending on whether you do extensions or not
X509v3_add_ext or various X509V3_ routines for extensions 
then X509_sign using (private part of) CA-key in file B

and also save the child's privatekey for the child to use


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


Re: [openssl] Forming the correct chain for an end entity certificate Reg.

2012-07-27 Thread Ashok C
Also adding openSSL community into loop.

Thanks Dave. But main use case for me is the trust anchor update case.
I have a certain requirement which goes like this:
I have a client application which runs on my machine and it will attempt to
connect to multiple remote servers.
*At time T0:*
Client has old root. All servers have old end entity, connection goes fine.
*At time T1:*
Trust anchor updates itself and my client gets hold of the new root. But at
the same time it will not delete the old root since some servers would not
yet have procured the new end entity from the new root.
At this time, both roots would be present in my trust store. And I will
need to form the right certificate chain for a display command which should
display: new EE--new root. And not new EE--old root. For this, I would
need the AKI/SKI related checks. Since the issuer-id subject-name fields of
both old as well as new root would be same.

And regarding the some even don't have AKI/SKI, I read the RFC and it
mandates the presence of these extensions in all conforming CAs.
--
Ashok

On Fri, Jul 27, 2012 at 4:18 AM, Dave Thompson dthomp...@prinpay.comwrote:

 **
 I'm not certain that actually works as described.

 I see the checks in crypto/x509/x509_vfy.c and crypto/x509v3/v3_purp.c,
 but the 'search for parent' part has multiple options spread over several
 sourcefiles --
 the standard ways are to look in a file commonly designated CAfile and/or
 a directory commonly designated CApath, but there are several ways to
 extend this.
 There are comments on x509_lu.c _get1_issuer, but I'm not sure if/when
 they apply.

 It has never been an issue for me, because all the CAs I've seen
 have distinct DN's for each cert they issue, i.e. they never need
 to disambiguate using AKI/SKI. And some don't even *have* AKI/SKI.

 Good luck.

  --
 *From:* Ashok C [mailto:ash@gmail.com]
 *Sent:* Thursday, 26 July, 2012 02:08
 *To:* Dave Thompson
 *Subject:* Fwd: Forming the correct chain for an end entity certificate
 Reg.

 Hi Dave,

 Could you please help me on this?

 --
 Ashok

 -- Forwarded message --
 From: Ashok C ash@gmail.com
 Date: Mon, Jul 23, 2012 at 12:11 PM
 Subject: Forming the correct chain for an end entity certificate Reg.
 To: openssl-users@openssl.org


 Hi,

 I have a requirement to form a correct certificate chain (for a server
 application, to send to client).
 Currently I was forming the chain using the issuer-id and subject name
 combination alone.
 Eg: The algorithm followed was:
 Let End entity(server certificate) be called as 'E'. Root certificate as
 'R' , and intermediate CA certificate be 'I'.


1. Look up E's issuer-id. Let it be 'C=IN'.  Chain at this step: E
2. Search trust store for CA certificate which has this 'C=IN' as
subject name and add it to chain. This is I. Chain at this step: E-I
3. Look at issuer-id of I and search trust store which has it as
subject-name. In this case I will find 'R'. Since for 'R' issuer-id and
subject-name are same, this is considered to be root and hence not added to
chain.

 But, I find that this chain is not conclusive enough, as
 subject-name==issuer-id is not a complete criteria for a root certificate
 and also that I cannot be treated as issuer of E just because of the
 success of the issuer-id/subject-name checks.
 I read the openSSL verify man page and understood that checks related to
 authority key identifier and subject key identifier are required to decide
 upon the correct chain.

 So I presume that the logic should be modified to look something like this:


1. Look up E's issuer-id. Let it be 'C=IN'.  Chain at this step: E
2. Search trust store for CA certificate which has this 'C=IN' as
subject name. This is I. Check if authority key identifier of E is the
same as the subject key identifier of I. If this is true, add it to
chain. Chain at this step: E-I
3. Look at issuer-id of I and search trust store which has it as
subject-name. In this case I will find 'R'. Check if authority key
identifier of I is the same as the subject key identifier of R. 'R' can
be concluded as the root only if subject-name==issuer-id and
authority-key-identifier==subject-key-identifier.

 Is this solution complete for a multi-level hierarchy? As of now, I do not
 have to deal with cross-certification, though I am very interested to know
 from you guys on the complications involved when that comes into the
 picture. I understand there is RFC 4158 explaining this path formation, but
 was wondering that needs to be read in detail only for the
 cross-certification related parts.

 Does openSSL have any sample implementation somewhere for this path
 formation(subject-key/authority-key checks) which I could use for reference?
 Thanks in advance.

 Regards,
 Ashok





Re: Certificate and Certificate request (Using API)

2012-07-27 Thread Saurabh Pandya
Bang !! Thanks Dave,

I am agree with Sandy's comment about openssl API's documentation.

Thanks again,
Saurabh


On 7/28/12, Dave Thompson dthomp...@prinpay.com wrote:
 From: owner-openssl-us...@openssl.org On Behalf Of Saurabh Pandya
 Sent: Friday, 27 July, 2012 10:21

 On 7/27/12, Saurabh Pandya er.saurabhpan...@gmail.com wrote:
  Do roughly the same thing apps/ca.c does, except you probably don't
  need all its options but may want some other options:
 
  Create an X509 and set all needed X509_CINF fields in that X509
  to values that you either extract from the X509_REQ and approve,
  or choose by your own logic (serial at least). Then sign the X509.
 
  Using My self-signed CA's private key, isn't it ??

 Yes. See below.

 I am asking this as I have the basic question about
 certificate signing

   - I have my self-sign CA A and CA key file B

 I assume that's CA-cert file A and CA-key file B

   - I create another RSA key pair EVP_PKEY *pkey to be used for
 child leaf certificates
   - I create a certificate X509 *x (that supposed to
 be child of my CA)
   I am setting public key by, that will set public key
 part of rsa key pkey, to my certificate x
   X509_set_pubkey(x,pkey)
   And I am signing certificate with my private key
   x509_sign(x,pkey)

 No. That makes the child self-signed, not signed by the CA.

   Then How can I make my normal server certificate
 x as a child of
   my CA certificate A, do i need to sign it with B.

   I am confuse which keys to set in X509_set_pubkey()
 and  X509_sign
   when I want a certificate appeared to be issued by my CA.

 X509_set_pubkey to (public part of) child's key (pkey)
 X509_set_subject_name to name of the child
 X509_set_issuer_name to name of the CA, specifically
   X509_get_subject_name from the CA-cert in file A.
 X509_set_serialNumber to a unique value you choose
   (some CA's use actual serial numbers 1,2,3,... but most
   nowadays use an obscured or totally random sequence)
 X509_set_notBefore,notAfter as desired (usually notBefore=now
   notAfter=now plus some interval like 3 months, 1 year, etc.)
 X509_set_version depending on whether you do extensions or not
 X509v3_add_ext or various X509V3_ routines for extensions
 then X509_sign using (private part of) CA-key in file B

 and also save the child's privatekey for the child to use


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

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