secure-preferences
secure-preferences copied to clipboard
Wrong parameters order in one constructor
Hello!
I noted wrong parameters order in one of the constructors.
We have main one (line 130) - private SecurePreferences(Context context, final AesCbcWithIntegrity.SecretKeys secretKey, final String password, final String salt, final String sharedPrefFilename, int iterationCount)
Params:
- context
- secretKey
- password
- salt
- sharedPrefFilename
- iterationCount
Also, we have another one (line 126) -
public SecurePreferences(Context context, final String password, final String salt, final String sharedPrefFilename, int iterationCount) { this(context, null, password, sharedPrefFilename, salt, iterationCount); }
If we see to "this()" call to main one we can note that we have this order:
- context
- secretKey
- password
- sharedPrefFilename
- salt
- iterationCount
Good. But, if we consider in detail, in main constructor we have 4. salt (instead of sharedPrefFilename in second one) 5. sharedPrefFilename (instead of salt in second one)

Maybe i'm wrong, but my xml files have are named with my password string and only after fixing order I got right file names.
Hope it helps. Regards, Alexey.
Hey @DominuS-RU nice spot thanks. This will be fixed in 0.1.6
One more mistake.

We pass null salt as password and password as salt.
to confirm this is the switch you meant @DominuS-RU?.
@scottyab Yes, this is the swith for the first one. (The second screenshot is about another mistake)
Hi, is there a release date for this fix? In 0.1.6 it's still present:
/**
* @param context should be ApplicationContext not Activity
* @param iterationCount The iteration count for the keys generation
*/
public SecurePreferences(Context context, final String password, final String salt, final String sharedPrefFilename, int iterationCount) {
this(context, null, password, sharedPrefFilename, salt, iterationCount);
}
private SecurePreferences(Context context, final AesCbcWithIntegrity.SecretKeys secretKey, final String password, final String salt, final String sharedPrefFilename, int iterationCount) {
if (sharedPreferences == null) {
sharedPreferences = getSharedPreferenceFile(context, sharedPrefFilename);
}
...
@scottyab Any progress on that?