Android Keystore Provider - How to store an API key -
Text after "
In my Android app, I have an API token that I received from an HTTP request
I Some research done, and, it seems to be the best way to store this key, with the Android keyStore provider.
I had a look at documentation
But since I am new to Android and with programs in general, I need some help in that place to put < / P>
I'm sure the key in which I should save, not the key.
calendars calorie = Calendar.getInstance (); Date now = cal.getTime (); Cal.add (Calendar: IEER, 1); Date expiry = cal.getTime (); KeyPair Generator kpg = KeyPairGenerator.getInstance ("RSA", "AndroidKeyStore"); kpg.initialize (New KeyPairGeneratorSpec.Builder (getApplicationContext ()) .setAlias (nickname) .setStartDate (now) .setEndDate (end) .setSerialNumber (BigInteger.valueOf (1)) .setSubject (New X500Principal ( "CN = test1 ")) .build ()); Kipier KP = kpg.generateKeyPair ();
Then how should I retrieve the following code using the key, (I think):
KeyStore ks = KeyStore.getInstance ("AndroidKeyStore"); Ks.load (zero); Calculation & LT; String & gt; Aliases = ks.aliases ();
Thank you for your help. "Text" itemprop = "text">
I think your API token is valid only for a certain period. Just enter it in a shared context for your code
if it is not, or it's expired, just get another one.
Comments
Post a Comment