I have a cert in memory in PEM format.
Can I get the public key out of the WOLFSSL_CTX structure after I do a load verify buffer?
or
Can I pass the PEM data to InitDecodedCert and get the cert and then get the public key out of that?
or
Can I convert the PEM in memory to a DER then use InitDecodedCert to get the cert?
If not I will just put the DER in the system in place of the PEM but I would rather use the PEM as is.
BTW I do not have a file system so the convert PEM file to DER is not an option.

I am trying to get Aes to work and I am having an issue with it hard faulting.

I call this to generate the key

ret = wc_RNG_GenerateBlock(&sysRNG,iv,AESSIZE);
ret=wc_AesSetKey(&denc,aesKey,AESSIZE,iv,AES_DECRYPTION);

And then call this to decrypt each packet as it comes in.

wc_AesCbcDecrypt(&denc,block,cipher,*size);

and this is my settings.h file
#ifdef WOLFSSL_STM32F2
    #define SIZEOF_LONG_LONG 8
    #define NO_DEV_RANDOM
    #define NO_WOLFSSL_DIR
    #define NO_RABBIT
    #define STM32F2_RNG
    #define STM32F2_CRYPTO
    #define KEIL_INTRINSICS
    #define NO_WRITEV
    #define NO_FILESYSTEM
    #define NO_DES3
    #undef  NO_AES
    #define SINGLE_THREADED
    #define WOLFSSL_KEY_GEN
    #define RSA_DECODE_EXTRA
#endif

Any ideas I am using an STM32F4 but the crypto block is supposed to be compatible

3

(7 replies, posted in wolfCrypt)

Thanks Chris. I got it working. The issue was that the inx on the call to the decode was not set to zero. Everything works great now and I have to say I am impressed with WolfSSL.
Thank you again for all your help.

4

(1 replies, posted in wolfCrypt)

I have been looking for a function to convert an RSA public key into a DER for a test version.
I have been trying to convert a Der  into an RSA key using wc_RsaPublicKeyDecode but I keep getting an invalid format error. I would like to create the RSA key then convert the RSA public into a DER for testing using WolfSSL

5

(7 replies, posted in wolfCrypt)

Thanks I tried that and so far so good but when I try to decode the Der I get ASN_PARSE_E        = -140.
I did compare the contents of the file with my data structure and it matched so the right data is being sent to the function call wc_RsaPublicKeyDecode.
This is just a public key in Der format and not a cert.

6

(7 replies, posted in wolfCrypt)

I am new to RSA so this may be a dumb question.
How do you convert a public key in DER format into an RSAKey