Fix transaction during installation

This commit is contained in:
Arnaud Fontaine
2017-08-18 16:33:56 +02:00
parent 309dbbad8a
commit 04a66b376d
5 changed files with 54 additions and 40 deletions

View File

@@ -51,10 +51,10 @@ public final class PGPKey {
attributes = new byte[Constants.ALGORITHM_ATTRIBUTES_MAX_LENGTH];
attributes_length = 0;
reset();
reset(true);
}
private final void resetKeys() {
private final void resetKeys(final boolean isRegistering) {
if(keys != null) {
keys.getPrivate().clearKey();
keys.getPublic().clearKey();
@@ -66,15 +66,15 @@ public final class PGPKey {
Util.arrayFillNonAtomic(certificate, (short)0, certificate_length, (byte)0);
}
fingerprint.reset();
fingerprint.reset(isRegistering);
Util.arrayFillNonAtomic(generation_date, (short)0, Constants.GENERATION_DATE_SIZE, (byte)0);
}
protected final void reset() {
resetKeys();
protected final void reset(final boolean isRegistering) {
resetKeys(isRegistering);
JCSystem.beginTransaction();
Common.beginTransaction(isRegistering);
if(attributes_length > 0) {
Util.arrayFillNonAtomic(attributes, (short)0, attributes_length, (byte)0);
attributes_length = (byte)0;
@@ -84,7 +84,7 @@ public final class PGPKey {
attributes, (short)0,
(short)Constants.ALGORITHM_ATTRIBUTES_DEFAULT.length);
attributes_length = (byte)Constants.ALGORITHM_ATTRIBUTES_DEFAULT.length;
JCSystem.commitTransaction();
Common.commitTransaction(isRegistering);
}
protected final boolean isInitialized() {
@@ -141,7 +141,7 @@ public final class PGPKey {
return;
}
resetKeys();
resetKeys(false);
JCSystem.beginTransaction();
if(attributes_length > 0) {
@@ -199,7 +199,7 @@ public final class PGPKey {
return;
}
resetKeys();
resetKeys(false);
keys = nkeys;
}
@@ -380,7 +380,7 @@ public final class PGPKey {
return;
}
resetKeys();
resetKeys(false);
keys = nkeys;
}