Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
avazirna committed Jan 23, 2024
1 parent 48aa5a5 commit af8194a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions app/src/org/commcare/utils/KeyStoreEncryptionKeyProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import androidx.annotation.RequiresApi;

import static org.commcare.util.EncryptionKeyHelper.CC_KEY_ALGORITHM_RSA;
import static org.commcare.utils.GlobalConstants.KEYSTORE_NAME;

/**
* Class for providing encryption keys backed by Android Keystore
Expand All @@ -49,7 +48,7 @@ public Key generateCryptographicKeyInKeyStore(String keyAlias,
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
KeyGenerator keyGenerator = KeyGenerator
.getInstance(KeyProperties.KEY_ALGORITHM_AES, KEYSTORE_NAME);
.getInstance(KeyProperties.KEY_ALGORITHM_AES, getKeyStoreName());
KeyGenParameterSpec keyGenParameterSpec = new KeyGenParameterSpec.Builder(keyAlias,
KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
.setBlockModes(BLOCK_MODE)
Expand All @@ -63,7 +62,7 @@ public Key generateCryptographicKeyInKeyStore(String keyAlias,
// hence the need to switch to a correspondent algorithm as well, RSA
// TODO: Add link to StackOverflow page
KeyPairGenerator keyGenerator = KeyPairGenerator
.getInstance(CC_KEY_ALGORITHM_RSA, KEYSTORE_NAME);
.getInstance(CC_KEY_ALGORITHM_RSA, getKeyStoreName());
GregorianCalendar start = new GregorianCalendar();
GregorianCalendar end = new GregorianCalendar();
end.add(GregorianCalendar.YEAR, 100);
Expand Down Expand Up @@ -106,6 +105,6 @@ public String getTransformationString() {

@Override
public String getKeyStoreName() {
return "AndroidKeyStore";
return GlobalConstants.KEYSTORE_NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.robolectric.annotation.Config

@Config(application = CommCareTestApplication::class)
@RunWith(AndroidJUnit4::class)
public class EncryptCredentialsInMemoryTest {
class EncryptCredentialsInMemoryTest {

@Before
fun setup() {
Expand Down Expand Up @@ -48,7 +48,7 @@ public class EncryptCredentialsInMemoryTest {
TestAppInstaller.login(TEST_USER, TEST_PASS)

// retrieve the logged in user, this should be using the encrypted version
var user = CommCareApplication.instance().getSession().getLoggedInUser()
var user = CommCareApplication.instance().session.loggedInUser

// save the same username and store the username for future comparison
user.setUsername(TEST_USER)
Expand Down

0 comments on commit af8194a

Please sign in to comment.