| 122 | /// Finalises and returns the authentication tag. The instance is reset and |
| 123 | /// can be reused for another message with the same key. |
| 124 | public byte[] doFinal() { |
| 125 | if (!started) { |
| 126 | hash.update(innerKey, 0, innerKey.length); |
| 127 | started = true; |
| 128 | } |
| 129 | byte[] inner = hash.digest(); |
| 130 | hash.update(outerKey, 0, outerKey.length); |
| 131 | hash.update(inner, 0, inner.length); |
| 132 | byte[] tag = hash.digest(); |
| 133 | started = false; |
| 134 | return tag; |
| 135 | } |
| 136 | |
| 137 | /// One-shot convenience. |
| 138 | public byte[] doFinal(byte[] data) { |