public class AsconVarPrfASpi extends AsconMacSpi
Ascon-Prfa is parameterized by the key length (128-bit), output rate (128-bit), the internal round number (8-rounds), and the tag of variable length. Ascon message authentication modes use the same lightweight 320-bit permutation as the authenticated encryption modes.
The authentication algorithm takes as its input a 128-bit secret key and a message of arbitrary length.
Further, the length of the tag is chosen by the user and passed to the PRF instance with the AsconParameterSpec.
After each absorbed or squeezed block except the last, the intermediate 8-round permutation is applied to the state, processing the plaintext.
For Ascon-Prf, an intermediate 12-round permutation is applied.
The full 12-round permutation is applied for both Ascon-Prfa and Ascon-Prf
during the initialization and finalization after the last message block.
Finally, it produces a tag as its output.
For more details we refer to the official Ascon specification.
Usage example:
// register IAIK-LW provider IaikLw.addAsProvider();
// the message to be processed byte[] msg = ...;
// generate the secret key
KeyGenerator keyGenerator = KeyGenerator.getInstance("Ascon-Mac");
SecretKey key = keyGenerator.generateKey();
// generate a AsconParameterSpec specifying the tag length int tagLength = ...; AsconParameterSpec parameterSpec = new AsconParameterSpec(tagLength);
// generate the tag
Mac prf = Mac.getInstance("Ascon-Prf");
prf.init(secretKey, parameterSpec);
prf.update(msg);
byte[] result = mac.doFinal();
AsconVarPrfSpi,
AsconParameterSpec,
Ascon128CipherSpi| Constructor and Description |
|---|
AsconVarPrfASpi() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
getRate()
Gets the block rate for the variant in bytes.
|
protected String |
getVariant()
Gets the variant name.
|
engineDoFinal, engineGetMacLength, engineInit, engineReset, engineUpdate, engineUpdateclone, engineUpdateprotected String getVariant()
getVariant in class AsconMacSpiprotected int getRate()
getRate in class AsconMacSpiCopyright © 2022–2023 Stiftung SIC. All rights reserved.