public class AsconVarPrfSpi extends AsconMacSpi
Ascon-Prf is parameterized by the key length (128-bit), output rate (128-bit), the internal round number (12-rounds), and the tag of variable length.
Ascon message authentication modes use the same lightweight 320-bit permutation as the authenticated encryption modes Ascon-128.
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 12-round permutation is applied to the state, processing the plaintext.
Finally, a tag is produced 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-Prf");
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 = prf.doFinal();
AsconVarPrfASpi,
AsconMacSpi,
Ascon128CipherSpi,
AsconParameterSpec| Constructor and Description |
|---|
AsconVarPrfSpi() |
| 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.