Add comments

This commit is contained in:
andrew 2023-05-05 12:18:39 +09:30
parent 24741fcc22
commit a152250a60

View File

@ -51,6 +51,9 @@ public final class KeyStoreHelper {
SecretKey secretKey = getOrCreateKeyStoreEntry();
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) {
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
@ -69,6 +72,9 @@ public final class KeyStoreHelper {
SecretKey secretKey = getKeyStoreEntry();
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) {
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(Cipher.DECRYPT_MODE, secretKey, new GCMParameterSpec(128, sealedData.iv));