@Override protected byte[] engineDoFinal() { try { ensureKeystoreOperationInitialized(); } catch (InvalidKeyException e) { throw new ProviderException("Failed to reinitialize MAC", e); } byte[] result; try { result = mChunkedStreamer.doFinal( null, 0, 0, null, // no signature provided -- this invocation will generate one null // no additional entropy needed -- HMAC is deterministic ); } catch (KeyStoreException e) { throw new ProviderException("Keystore operation failed", e); } resetWhilePreservingInitState(); return result; }
@Override protected void engineUpdate(byte[] input, int offset, int len) { try { ensureKeystoreOperationInitialized(); } catch (InvalidKeyException e) { throw new ProviderException("Failed to reinitialize MAC", e); } byte[] output; try { output = mChunkedStreamer.update(input, offset, len); } catch (KeyStoreException e) { throw new ProviderException("Keystore operation failed", e); } if ((output != null) && (output.length != 0)) { throw new ProviderException("Update operation unexpectedly produced output"); } }