Quick Answer: How Do I Save a Secret Key on Android?
Contents

How do I store my secret key?

1 Answer

  1. Create a key pair at your server, store public and private keys. …
  2. Include the public key in your application;
  3. The application uses a secure random generator to create an AES key;
  4. The data is encrypted using CBC and PKCS#7 padding, also include a HMAC (possibly with yet another random AES key);

Where are Android secret keys stored?

For storing fixed API keys, the following common strategies exist for storing secrets in your source code:

  1. Hidden in BuildConfigs.
  2. Embedded in resource file.
  3. Obfuscating with Proguard.
  4. Disguised or Encrypted Strings.
  5. Hidden in native libraries with NDK.
  6. Hidden as constants in source code.
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest