public abstract class AndroidKeyStoreHmacSpi extends MacSpi implements KeyStoreCryptoOperation
MacSpi
which provides HMAC implementations backed by Android KeyStore.Modifier and Type | Class and Description |
---|---|
static class |
AndroidKeyStoreHmacSpi.HmacSHA1 |
static class |
AndroidKeyStoreHmacSpi.HmacSHA224 |
static class |
AndroidKeyStoreHmacSpi.HmacSHA256 |
static class |
AndroidKeyStoreHmacSpi.HmacSHA384 |
static class |
AndroidKeyStoreHmacSpi.HmacSHA512 |
Modifier | Constructor and Description |
---|---|
protected |
AndroidKeyStoreHmacSpi(int keymasterDigest) |
Modifier and Type | Method and Description |
---|---|
protected byte[] |
engineDoFinal()
Completes the MAC computation and resets the MAC for further use,
maintaining the secret key that the MAC was initialized with.
|
protected int |
engineGetMacLength()
Returns the length of the MAC in bytes.
|
protected void |
engineInit(Key key,
AlgorithmParameterSpec params)
Initializes the MAC with the given (secret) key and algorithm
parameters.
|
protected void |
engineReset()
Resets the MAC for further use, maintaining the secret key that the
MAC was initialized with.
|
protected void |
engineUpdate(byte input)
Processes the given byte.
|
protected void |
engineUpdate(byte[] input,
int offset,
int len)
Processes the first
len bytes in input ,
starting at offset inclusive. |
void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
long |
getOperationHandle()
Gets the KeyStore operation handle of this crypto operation.
|
clone, engineUpdate
protected int engineGetMacLength()
MacSpi
engineGetMacLength
in class MacSpi
protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException
MacSpi
engineInit
in class MacSpi
key
- the (secret) key.params
- the algorithm parameters.InvalidKeyException
- if the given key is inappropriate for
initializing this MAC.InvalidAlgorithmParameterException
- if the given algorithm
parameters are inappropriate for this MAC.protected void engineReset()
MacSpi
engineReset
in class MacSpi
protected void engineUpdate(byte input)
MacSpi
engineUpdate
in class MacSpi
input
- the input byte to be processed.protected void engineUpdate(byte[] input, int offset, int len)
MacSpi
len
bytes in input
,
starting at offset
inclusive.engineUpdate
in class MacSpi
input
- the input buffer.offset
- the offset in input
where the input starts.len
- the number of bytes to process.protected byte[] engineDoFinal()
MacSpi
engineDoFinal
in class MacSpi
public void finalize() throws Throwable
Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the JavaTM virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
public long getOperationHandle()
KeyStoreCryptoOperation
getOperationHandle
in interface KeyStoreCryptoOperation
0
if the KeyStore operation is not in progress.