Package com.google.crypto.tink.subtle
Class PrfHmacJce
- java.lang.Object
-
- com.google.crypto.tink.subtle.PrfHmacJce
-
-
Field Summary
Fields Modifier and Type Field Description static TinkFipsUtil.AlgorithmFipsCompatibilityFIPS
-
Constructor Summary
Constructors Constructor Description PrfHmacJce(java.lang.String algorithm, java.security.Key key)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]compute(byte[] data, int outputLength)Computes the PRF selected by the underlying key on input and returns the first outputLength bytes.static Prfcreate(HmacPrfKey key)Given an HmacPrfKey, returns an instance of the Prf interface.intgetMaxOutputLength()Returns the maximum supported tag length.
-
-
-
Field Detail
-
FIPS
public static final TinkFipsUtil.AlgorithmFipsCompatibility FIPS
-
-
Method Detail
-
create
public static Prf create(HmacPrfKey key) throws java.security.GeneralSecurityException
Given an HmacPrfKey, returns an instance of the Prf interface.- Throws:
java.security.GeneralSecurityException
-
compute
public byte[] compute(byte[] data, int outputLength) throws java.security.GeneralSecurityExceptionDescription copied from interface:PrfComputes the PRF selected by the underlying key on input and returns the first outputLength bytes.- Specified by:
computein interfacePrf- Parameters:
data- the input to compute the PRF on.outputLength- the desired length of the output in bytes. When choosing this parameter keep the birthday paradox in mind. If you have 2^n different inputs that your system has to handle set the output length to ceil(n/4 + 4) This corresponds to 2*n + 32 bits, meaning a collision will occur with a probability less than 1:2^32. When in doubt, request a security review.- Throws:
java.security.GeneralSecurityException- if the algorithm fails or if the output of algorithm is less than outputLength.
-
getMaxOutputLength
public int getMaxOutputLength()
Returns the maximum supported tag length.
-
-