Class LegacyFullPrf
- java.lang.Object
-
- com.google.crypto.tink.prf.internal.LegacyFullPrf
-
- All Implemented Interfaces:
Prf
@Immutable public class LegacyFullPrf extends java.lang.Object implements Prf
Takes an arbitrary raw Prf and makes it a full primitive. ("Full" doesn't make much difference in case of PRFs but we keep the name for consistency with the other primitives.) This is a class that helps us transition onto the new Keys and Configurations interface, by bringing potential user-defined primitives to a common denominator with our primitives over which we have control.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]compute(byte[] input, int outputLength)Computes the PRF selected by the underlying key on input and returns the first outputLength bytes.static Prfcreate(LegacyProtoKey key)This method covers the cases where users created their own prf/key classes.
-
-
-
Method Detail
-
create
public static Prf create(LegacyProtoKey key) throws java.security.GeneralSecurityException
This method covers the cases where users created their own prf/key classes.- Throws:
java.security.GeneralSecurityException
-
compute
public byte[] compute(byte[] input, 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:
input- 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.
-
-