public abstract class PinProtectedProvider extends java.lang.Object implements EncryptionProvider
Constructor and Description |
---|
PinProtectedProvider()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
changePinCode(android.content.Context context,
java.lang.String oldPin,
java.lang.String newPin)
Changes the pin code if the old pin provided matches
|
protected abstract Encrypter |
createEncrypter(com.tozny.crypto.android.AesCbcWithIntegrity.SecretKeys masterKey) |
void |
createPinCode(android.content.Context context,
java.lang.String pin)
Create a pin code from the provided input
|
Encrypter |
getEncrypter()
Returns the Encrypter for data being written to disk, which should be initialized in
EncryptionProvider.startWithPassphrase(android.content.Context, java.lang.String) . |
boolean |
hasPinCode(android.content.Context context)
Returns whether the user has created a pin code.
|
void |
logAccessTime()
Logs the time of access for deciding whether to re-prompt the user for a pin after having
been away from the app for longer than the lock time.
|
boolean |
needsAuth(android.content.Context context,
PinCodeConfig codeConfig)
Returns a boolean indicating whether authentication is needed.
|
boolean |
passphraseExists(android.content.Context context) |
void |
startWithPassphrase(android.content.Context context,
java.lang.String passphrase)
This method should attempt to initialize the Encrypter with the provided pin, otherwise it
should throw a
StorageAccessException |
public Encrypter getEncrypter()
EncryptionProvider
EncryptionProvider.startWithPassphrase(android.content.Context, java.lang.String)
.getEncrypter
in interface EncryptionProvider
public void logAccessTime()
EncryptionProvider
logAccessTime
in interface EncryptionProvider
public boolean hasPinCode(android.content.Context context)
EncryptionProvider
hasPinCode
in interface EncryptionProvider
context
- android contextpublic void createPinCode(android.content.Context context, java.lang.String pin)
EncryptionProvider
createPinCode
in interface EncryptionProvider
context
- android contextpin
- the pin that the user enteredpublic void changePinCode(android.content.Context context, java.lang.String oldPin, java.lang.String newPin)
EncryptionProvider
changePinCode
in interface EncryptionProvider
context
- android contextoldPin
- user input for old pinnewPin
- user input for the new pinprotected abstract Encrypter createEncrypter(com.tozny.crypto.android.AesCbcWithIntegrity.SecretKeys masterKey)
public void startWithPassphrase(android.content.Context context, java.lang.String passphrase)
EncryptionProvider
StorageAccessException
startWithPassphrase
in interface EncryptionProvider
context
- android contextpassphrase
- the pin input from the userpublic boolean passphraseExists(android.content.Context context)
public boolean needsAuth(android.content.Context context, PinCodeConfig codeConfig)
EncryptionProvider
needsAuth
in interface EncryptionProvider
context
- android contextcodeConfig
- the pin config for the app