Definition at line 25 of file KeystoreHelper.java.
◆ getInstance()
| static KeystoreHelper com.freerdp.freerdpcore.security.KeystoreHelper.getInstance |
( |
Context |
context | ) |
|
|
inlinestatic |
Definition at line 45 of file KeystoreHelper.java.
46 {
47 if (instance == null)
48 {
49 synchronized (KeystoreHelper.class)
50 {
51 if (instance == null)
52 {
53 instance = new KeystoreHelper(context);
54 }
55 }
56 }
57 return instance;
58 }
◆ getOrCreateDbKey()
| byte[] com.freerdp.freerdpcore.security.KeystoreHelper.getOrCreateDbKey |
( |
| ) |
throws KeystoreException |
|
inline |
Definition at line 60 of file KeystoreHelper.java.
61 {
62 SharedPreferences prefs =
63 applicationContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
64 String encoded = prefs.getString(PREF_ENCRYPTED_DB_KEY, null);
65
66 if (encoded != null)
67 {
68 return decryptDbKey(encoded);
69 }
70
71 byte[] rawKey = new byte[DB_KEY_LENGTH];
72 new SecureRandom().nextBytes(rawKey);
73 String encrypted = encryptDbKey(rawKey);
74 prefs.edit().putString(PREF_ENCRYPTED_DB_KEY, encrypted).apply();
75 return rawKey;
76 }
The documentation for this class was generated from the following file: