<html><body><p><tt><font size="2">> From: prudvi raj <rajprudvi98@gmail.com></font></tt><br><tt><font size="2">> To: openssl-users@openssl.org</font></tt><br><tt><font size="2">> Date: 07/10/2020 07:55 AM</font></tt><br><tt><font size="2">> Subject: [EXTERNAL] get data from X509_EXTENSION in openSSL 1.1.1.</font></tt><br><tt><font size="2">> Sent by: "openssl-users" <openssl-users-bounces@openssl.org></font></tt><br><tt><font size="2">> <br>> Hi All,</font></tt><br><tt><font size="2">> <br>> we are upgrading our codebase to 1.1.1 from 1.0.2k.Here's a code <br>> snippet causing error :</font></tt><br><tt><font size="2">> <br>>  ext = X509_get_ext(X509, n);</font></tt><br><tt><font size="2">>  data = ext->value->data;</font></tt><br><tt><font size="2">> <br>> How do i get the data value from X509_EXTENSION object.</font></tt><br><tt><font size="2">> since forward declarations are not allowed (compiler error) & i <br>> couldn't find a suitable 'getter' function.</font></tt><br><tt><font size="2">> Can someone please help me out in resolving this issue.??</font></tt><br><br><tt><font size="2">This may work:</font></tt><br><br><tt><font size="2">ASN1_BIT_STRING         *keyUsage = </font></tt><br><tt><font size="2">        X509_get_ext_d2i(X509Certificate, NID_key_usage,</font></tt><br><tt><font size="2">                                    NULL, NULL);</font></tt><br><tt><font size="2">uint8_t bitmap = </font></tt><tt><font size="2">bitmap = keyUsage->data[0];</font></tt><br><tt><font size="2">keyEncipherment = bitmap & (1<<5);                /* bit 2 little endian */</font></tt><br><BR>
</body></html>