Wipe masterPassword on authentication & misc improvements.
This commit is contained in:
@@ -77,7 +77,7 @@ public abstract class MPAlgorithm {
|
||||
* for the case where {@code resultType} is a {@link MPResultTypeClass#Stateful}.
|
||||
*/
|
||||
public abstract String siteResultFromState(byte[] masterKey, byte[] siteKey,
|
||||
MPResultType resultType, @Nullable String resultParam);
|
||||
MPResultType resultType, String resultParam);
|
||||
|
||||
/**
|
||||
* The result for {@link #siteResult(byte[], byte[], String, UnsignedInteger, MPKeyPurpose, String, MPResultType, String)}
|
||||
|
@@ -44,13 +44,14 @@ public class MPMasterKey {
|
||||
|
||||
/**
|
||||
* @param masterPassword The characters of the user's master password.
|
||||
* Note: this array is held by reference and its contents invalidated on {@link #invalidate()}.
|
||||
* <b>Note: this method destroys the contents of the array.</b>
|
||||
*/
|
||||
@SuppressWarnings("AssignmentToCollectionOrArrayFieldFromParameter")
|
||||
public MPMasterKey(final String fullName, final char[] masterPassword) {
|
||||
|
||||
this.fullName = fullName;
|
||||
this.masterPassword = masterPassword;
|
||||
this.masterPassword = masterPassword.clone();
|
||||
Arrays.fill( masterPassword, (char) 0 );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -162,7 +163,7 @@ public class MPMasterKey {
|
||||
*/
|
||||
public String siteState(final String siteName, final MPAlgorithm algorithm, final UnsignedInteger siteCounter,
|
||||
final MPKeyPurpose keyPurpose, @Nullable final String keyContext,
|
||||
final MPResultType resultType, @Nullable final String resultParam)
|
||||
final MPResultType resultType, final String resultParam)
|
||||
throws MPKeyUnavailableException {
|
||||
|
||||
Preconditions.checkNotNull( resultParam );
|
||||
|
@@ -125,7 +125,7 @@ public class MPAlgorithmV0 extends MPAlgorithm {
|
||||
case Template:
|
||||
return siteResultFromTemplate( masterKey, siteKey, resultType, resultParam );
|
||||
case Stateful:
|
||||
return siteResultFromState( masterKey, siteKey, resultType, resultParam );
|
||||
return siteResultFromState( masterKey, siteKey, resultType, Preconditions.checkNotNull( resultParam ) );
|
||||
case Derive:
|
||||
return siteResultFromDerive( masterKey, siteKey, resultType, resultParam );
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public class MPAlgorithmV0 extends MPAlgorithm {
|
||||
|
||||
@Override
|
||||
public String siteResultFromState(final byte[] masterKey, final byte[] siteKey,
|
||||
final MPResultType resultType, @Nullable final String resultParam) {
|
||||
final MPResultType resultType, final String resultParam) {
|
||||
|
||||
Preconditions.checkNotNull( resultParam );
|
||||
Preconditions.checkArgument( !resultParam.isEmpty() );
|
||||
|
Reference in New Issue
Block a user