Skip to content

Commit

Permalink
Annotate code specific to API Level 23 and above in AWSKeyValueStore (#…
Browse files Browse the repository at this point in the history
…786)

* Secure information stored in SharedPreferences

* Lower aws-android-sdk-core-test compile and target sdk version to 27

* Add a symlink to android-23.jar for core

* Add a gradle task that creates a symlink to android-23.jar for AWS Core

* Fix the gradle task that creates symbolic link to android-23.jar

* Change config.yml to setup android-23

* Enable core, cognitoidentityprovider and cognitoauth integration tests on CircleCI

* Enable core, cognitoidentityprovider and cognitoauth integration tests on CircleCI

* Fix pom.xml

* Improve exception handling in AWSKeyValueStore

* [2.12.3] Bump the patch version of 2.12.z

* Update 2.12.3 CHANGELOG

* Add the missing bucket prefixes to CleanupBucketIntegrationTests

* Fix a bug where migrating expirationDate in CognitoCachingCredentialsProvider crashes

* [2.12.4] Update changelog and bump version

* Annotate code specific to API Level 23 and above in AWSKeyValueStore
  • Loading branch information
Karthikeyan authored Mar 13, 2019
1 parent a7a13b5 commit 50311c3
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@ public synchronized String get(String key) {
// Read from store -> Base64 decode -> decrypt -> convert to string
final String encryptedData = sharedPreferences.getString(actualKey, null);
byte[] iv = getInitializationVector(actualKey);
String decryptedDataInString = decrypt(apiLevel >= ANDROID_API_LEVEL_23
? new GCMParameterSpec(CIPHER_AES_GCM_NOPADDING_TAG_LENGTH_LENGTH_IN_BITS, iv)
: new IvParameterSpec(iv), encryptedData);
String decryptedDataInString = decrypt(
//@apiLevel23Start
apiLevel >= ANDROID_API_LEVEL_23 ? new GCMParameterSpec(CIPHER_AES_GCM_NOPADDING_TAG_LENGTH_LENGTH_IN_BITS, iv) :
//@apiLevel23End
new IvParameterSpec(iv), encryptedData);
cache.put(key, decryptedDataInString);
return decryptedDataInString;
} catch (Exception ex) {
Expand Down Expand Up @@ -233,9 +235,11 @@ public void put(String key, String value) {
try {
// Encrypt
byte[] iv = generateInitializationVector();
String encryptedData = encrypt(apiLevel >= ANDROID_API_LEVEL_23
? new GCMParameterSpec(CIPHER_AES_GCM_NOPADDING_TAG_LENGTH_LENGTH_IN_BITS, iv)
: new IvParameterSpec(iv), value);
String encryptedData = encrypt(
//@apiLevel23Start
apiLevel >= ANDROID_API_LEVEL_23 ? new GCMParameterSpec(CIPHER_AES_GCM_NOPADDING_TAG_LENGTH_LENGTH_IN_BITS, iv) :
//@apiLevel23End
new IvParameterSpec(iv), value);

// Persist
sharedPreferences
Expand Down

0 comments on commit 50311c3

Please sign in to comment.