1 (edited by sissiok 2015-07-21 10:45:10)

Topic: how to extra a rsa public key from a certificate

Hi, I am trying to extra the rsa public key from a certificate.  I found the following method in test.c:

DecodedCert cert;

InitDecodedCert(....);

ParseCert(....);

RsaPublicKeyDecode(....);

This method requires to define WOLFSSL_TEST_CERT. How to define and enable it?

Thanks a lot!

Share

Re: how to extra a rsa public key from a certificate

Hi sissiok,

Those functions are prototyped in the <wolfssl/wolfcrypt/asn.h> header file.

To define WOLFSSL_TEST_CERT, you need to add it to C_EXTRA_FLAGS if using ./configure:

cd wolfssl-3.6.0
./configure C_EXTRA_FLAGS="-DWOLFSSL_TEST_CERT"
make
sudo make install

Then, define it when compiling your application as well.

Best Regards,
Chris

Re: how to extra a rsa public key from a certificate

Can you please tell me how to define it in makefile?

My makefile looks like:

CC=g++
CFLAGS = -g -I -Wall -DHAVE_AESGCM -DWOLFSSL_KEY_GEN -DWOLFSSL_TEST_CERT

But "-DWOLFSSL_TEST_CERT" does not work as I got error: undefined reference to 'InitDecode'

Thanks!

Share

Re: how to extra a rsa public key from a certificate

Hi sissiok,

Are you also:

1) Including <wolfssl/wolfcrypt/asn.h> in your application?

2) Naming the function correctly?  Your error reads 'InitDecode', but the function name is 'InitDecodedCert()'

3)  Are you also compiling wolfSSL with the WOLFSSL_TEST_CERT define added to C_EXTRA_FLAGS during ./configure?

Thanks,
Chris