Using openSSL for encryption in Android NDK

Skip to first unread message

Nader Baydoun

Mar 12, 2021, 10:45:49 AM3/12/21
to android-ndk
Hello everyone,
I have started developing with android using java a while ago and I have made a handful of fully functioning apps but this is the first time I find myself in need of using NDK and C++.

I am using this plugin to store some API keys:

In the documentation, they mention that I can make things more secure by adding my own encryption algorithm, which I would like to do but I never touched C++ nor am I an expert at encryption so I figured if I can fit in the OpenSSL library for CPP, it comes with lots of pre-built cryptography functions I can use that.

Which is prebuilt code for the library for android.

My first issue is why does CPP need to be built this way? I am used to Java where I can click run and do not understand why you have to dig in and compile the code yourself with flags and all that. Also, pertaining to the library I have found, I do not exactly know what to do with this code...I already have a CMake file and some libraries in my android project because of the plugin installation. 

-Do I just grab the pre-built files and drop them into my CPP resource directory?
-What changes do I have to make to my CMake file to tell the system those files are there?
-I am saving my encrypted key into the environment variables, and the decryption function will make it readable, if the decryption function requires a decryption key, what would be the best way to hide this decryption key?

Thank you all kindly for your time :)

mic _

Mar 12, 2021, 10:59:02 AM3/12/21
Note that Google provides dependencies with prebuilt versions of OpenSSL (see So you don't have to grab them from some random person's github (not to mention that 1.0.2 is really old).

You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages