KeyChainGroup: Be smarter about encryption order.

This partly reverts commit 4ed5b0e3b06c18040d83be30df32e7be5b778b51.
This commit is contained in:
Matthew Leon
2019-03-28 22:23:58 -04:00
committed by Andreas Schildbach
parent 80dd4e39fa
commit c572bb52d7

View File

@@ -671,15 +671,17 @@ public class KeyChainGroup implements KeyBag {
// This code must be exception safe.
BasicKeyChain newBasic = basic.toEncrypted(keyCrypter, aesKey);
this.basic = newBasic;
List<DeterministicKeyChain> newChains = new ArrayList<>();
if (chains != null) {
for (DeterministicKeyChain chain : chains)
newChains.add(chain.toEncrypted(keyCrypter, aesKey));
}
this.keyCrypter = keyCrypter;
this.basic = newBasic;
if (chains != null) {
this.chains.clear();
this.chains.addAll(newChains);
}
this.keyCrypter = keyCrypter;
}
/**