mirror of
https://github.com/oxen-io/session-android.git
synced 2025-05-06 17:36:51 +00:00
Add comments
This commit is contained in:
parent
24741fcc22
commit
a152250a60
@ -51,6 +51,9 @@ public final class KeyStoreHelper {
|
|||||||
SecretKey secretKey = getOrCreateKeyStoreEntry();
|
SecretKey secretKey = getOrCreateKeyStoreEntry();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Cipher operations are not thread-safe so we synchronize over them through doFinal to
|
||||||
|
// prevent crashes with quickly repeated encrypt/decrypt operations
|
||||||
|
// https://github.com/mozilla-mobile/android-components/issues/5342
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
||||||
@ -69,6 +72,9 @@ public final class KeyStoreHelper {
|
|||||||
SecretKey secretKey = getKeyStoreEntry();
|
SecretKey secretKey = getKeyStoreEntry();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Cipher operations are not thread-safe so we synchronize over them through doFinal to
|
||||||
|
// prevent crashes with quickly repeated encrypt/decrypt operations
|
||||||
|
// https://github.com/mozilla-mobile/android-components/issues/5342
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
||||||
cipher.init(Cipher.DECRYPT_MODE, secretKey, new GCMParameterSpec(128, sealedData.iv));
|
cipher.init(Cipher.DECRYPT_MODE, secretKey, new GCMParameterSpec(128, sealedData.iv));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user