1 (edited by Frank Young 2014-08-03 12:37:00)

Topic: using only rsa from wolfCrypt

Can the wolfCrypt library be used alone?

I've being using wolfSSL for my embedded SSL and embedded TLS needs for getting to two years now and it is more than perfect.  But now I need to use only RSA from the library for a project and I felt I could use only wolfCrypt alone instead of the whole wolfSSL since i don't need ssl or tls; just rsa but I am running into some difficulties. I am building with vs2008.

Just for a test, I create an empty console application and include the rsa.h without even calling any function from wolfCrypt but it gives me lots of errors.  I may post them here if needed.

EDIT ----///

seems the version i was using is a little hold, so there were few bugs. I've just downloaded the latest version. I am not using certificate but it seems it is auto linking with certificate functions.

1>asn.obj : error LNK2001: unresolved external symbol _GetCA
1>asn.obj : error LNK2001: unresolved external symbol _GetCAByName


I defined NO_CERTS and NO_SKID hoping that will get raid of GetCAByName but it fails

Share

Re: using only rsa from wolfCrypt

Hi Frank,

Will you need functionality from asn.c/.h, or just functionality from rsa.c/.h?

It looks like rsa.c can be compiled individually as long as you include the following files as well:

arc4.c
integer.c
memory.c
random.c
rsa.c

This uses the normal big integer math library (integer.c).  To use the fastmath library instead, you'd use tfm.c instead of integer.c.

In ParseCertRelative() and ParseCRL() in asn.c use GetCA() and GetCAByName() which are located in ssl.c.

Best Regards,
Chris

3 (edited by Frank Young 2014-08-10 17:38:33)

Re: using only rsa from wolfCrypt

I am importing only three functions: InitRng, RsaPublicKeyDecode and RsaPublicEncrypt.

It seems RsaPublicKeyDecode is the one bringing in the GetCA and GetCAByname and is in asn.c
I think i have no option than to link with the whole wolfSSL embedded SSL library.

Since i am not using ssl/tls stuffs, do i still need to call  SSL_library_init(or its wolfSSL equivalent) and wolfSSL_Cleanup ?

//----EDIT

i have also noticed that there is RsaPrivateDecrypt but there is no RsaPrivateEncrypt likewise there is RsaPublicEncrypt but there is no RsaPublicDecrypt. So how do I encrypt data with private key since there is no RsaPrivateEncrypt and how do I decrypt data with public key since their is no RsaPublicDecrypt?

Share