2
0

Support resetting user's master password.

This commit is contained in:
Maarten Billemont
2018-07-28 21:53:08 -04:00
parent 978b758079
commit 37a7cfa530
9 changed files with 96 additions and 13 deletions

View File

@@ -82,11 +82,15 @@ public class MPMasterKey {
Arrays.fill( masterPassword, (char) 0 );
}
public boolean isValid() {
return !invalidated;
}
private byte[] masterKey(final MPAlgorithm algorithm)
throws MPKeyUnavailableException, MPAlgorithmException {
Preconditions.checkArgument( masterPassword.length > 0 );
if (invalidated)
if (!isValid())
throw new MPKeyUnavailableException( "Master key was invalidated." );
byte[] masterKey = keyByVersion.get( algorithm.version() );