diff --git a/src/fr/anssi/smartpgp/Persistent.java b/src/fr/anssi/smartpgp/Persistent.java index d93cdf2..66fe792 100644 --- a/src/fr/anssi/smartpgp/Persistent.java +++ b/src/fr/anssi/smartpgp/Persistent.java @@ -76,14 +76,14 @@ public final class Persistent { protected final byte[] key_derivation_function; protected short key_derivation_function_length; - protected final OwnerPIN user_pin; /* PW1 */ + protected OwnerPIN user_pin; /* PW1 */ protected byte user_pin_length; protected boolean user_pin_force_verify_signature; - protected final OwnerPIN user_puk; /* resetting code */ + protected OwnerPIN user_puk; /* resetting code */ protected byte user_puk_length; - protected final OwnerPIN admin_pin; /* PW3 */ + protected OwnerPIN admin_pin; /* PW3 */ protected byte admin_pin_length; @@ -235,6 +235,7 @@ protected void reset(final boolean isRegistering) { Common.beginTransaction(isRegistering); user_pin_length = (byte)Constants.USER_PIN_DEFAULT.length; + user_pin = new OwnerPIN(Constants.USER_PIN_RETRY_COUNT, Constants.USER_PIN_MAX_SIZE); user_pin.update(Constants.USER_PIN_DEFAULT, (short)0, user_pin_length); Common.endTransaction(isRegistering); user_pin.resetAndUnblock(); @@ -252,6 +253,7 @@ protected void reset(final boolean isRegistering) { Common.beginTransaction(isRegistering); admin_pin_length = (byte)Constants.ADMIN_PIN_DEFAULT.length; + admin_pin = new OwnerPIN(Constants.ADMIN_PIN_RETRY_COUNT, Constants.ADMIN_PIN_MAX_SIZE); admin_pin.update(Constants.ADMIN_PIN_DEFAULT, (short)0, admin_pin_length); Common.commitTransaction(isRegistering); admin_pin.resetAndUnblock(); diff --git a/src/fr/anssi/smartpgp/SmartPGPApplet.java b/src/fr/anssi/smartpgp/SmartPGPApplet.java index 111a756..40fba40 100644 --- a/src/fr/anssi/smartpgp/SmartPGPApplet.java +++ b/src/fr/anssi/smartpgp/SmartPGPApplet.java @@ -667,6 +667,7 @@ private final void processChangeReferenceData(final short lc, } JCSystem.beginTransaction(); data.user_pin_length = minlen; + data.user_pin = new OwnerPIN(Constants.USER_PIN_RETRY_COUNT, Constants.USER_PIN_MAX_SIZE); data.user_pin.update(transients.buffer, off, data.user_pin_length); JCSystem.commitTransaction(); data.user_pin.resetAndUnblock(); @@ -703,6 +704,7 @@ private final void processChangeReferenceData(final short lc, } JCSystem.beginTransaction(); data.admin_pin_length = minlen; + data.admin_pin = new OwnerPIN(Constants.ADMIN_PIN_RETRY_COUNT, Constants.ADMIN_PIN_MAX_SIZE); data.admin_pin.update(transients.buffer, off, data.admin_pin_length); JCSystem.commitTransaction(); data.admin_pin.resetAndUnblock(); @@ -762,6 +764,7 @@ private final void processResetRetryCounter(final short lc, } JCSystem.beginTransaction(); data.user_pin_length = minlen; + data.user_pin = new OwnerPIN(Constants.USER_PIN_RETRY_COUNT, Constants.USER_PIN_MAX_SIZE); data.user_pin.update(transients.buffer, off, data.user_pin_length); JCSystem.commitTransaction(); data.user_pin.resetAndUnblock(); @@ -785,6 +788,7 @@ private final void processResetRetryCounter(final short lc, transients.setUserPinMode82(false); JCSystem.beginTransaction(); data.user_pin_length = (byte)lc; + data.user_pin = new OwnerPIN(Constants.USER_PIN_RETRY_COUNT, Constants.USER_PIN_MAX_SIZE); data.user_pin.update(transients.buffer, (short)0, data.user_pin_length); JCSystem.commitTransaction(); data.user_pin.resetAndUnblock(); @@ -1165,6 +1169,7 @@ private final void processPutData(final short lc, } JCSystem.beginTransaction(); data.user_puk_length = (byte)lc; + data.user_puk = new OwnerPIN(Constants.USER_PUK_RETRY_COUNT, Constants.USER_PUK_MAX_SIZE); data.user_puk.update(buf, (short)0, data.user_puk_length); JCSystem.commitTransaction(); data.user_puk.resetAndUnblock();