Hi,You will have to go through Openssl source code.Have a look at following files:1. x509_v3.c (around line 74), You will find the following method:int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, int nid,int lastpos){ASN1_OBJECT *obj;obj=OBJ_nid2obj(nid);if (obj == NULL) return(-2);return(X509v3_get_ext_by_OBJ(x,obj,lastpos));}Hope this helps.
On Wed, Jul 25, 2012 at 7:08 AM, Puneet Khunteta <khuntet...@gmail.com> 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.
--Thanks
Puneet K.
Regards,Sukalp Bhople.
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
Hi All,
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…
[root@eLite1 CERT]# openssl s_client -connect 80.1.0.1:443 -ssl3 -cert client.crt -key client.key -CApath /root/CERT
CONNECTED(00000003)
depth=1 /C=US/ST=TX/L=FTW/O=NSN/CN=82.1.0.1
verify error:num=19:self signed certificate in certificate chain
verify return:0
---
Certificate chain
0 s:/C=US/ST=TX/L=FTW/O=NSN/CN=80.1.0.1
i:/C=US/ST=TX/L=FTW/O=NSN/CN=82.1.0.1
1 s:/C=US/ST=TX/L=FTW/O=NSN/CN=82.1.0.1
i:/C=US/ST=TX/L=FTW/O=NSN/CN=82.1.0.1
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFBjCCAu4CAQEwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UEBhMCVVMxCzAJBgNV
...
PZ6ww2xA989bF2G1zvHwJZsdSJOCuz/ueZ760XTdhPy8PCPbU+W9JNpv
-----END CERTIFICATE-----
subject=/C=US/ST=TX/L=FTW/O=NSN/CN=80.1.0.1
issuer=/C=US/ST=TX/L=FTW/O=NSN/CN=82.1.0.1
---
No client certificate CA names sent
---
SSL handshake has read 2998 bytes and written 709 bytes
---
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 4096 bit
Compression: zlib compression
Expansion: zlib compression
SSL-Session:
Protocol : SSLv3
Cipher : AES256-SHA
Session-ID: E09D355918C3C05C10A4B7E41BA223EA5F43A725457FB14470F727F1FE447ECD
Session-ID-ctx:
Master-Key: CCB3A02A4D9F090F140EFF30D18E5E82F653C77C8A66A439F4AA3E1F485713043F4AE0BEFFEB97F98D470DFD10554A20
Key-Arg : None
Krb5 Principal: None
Compression: 1 (zlib compression)
Start Time: 1343273949
Timeout : 7200 (sec)
Verify return code: 19 (self signed certificate in certificate chain)
---
closed
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.org> wrote:
You can retrieve a structure representing any supported extension using theOn 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.
>
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