Package com.google.crypto.tink
Class CryptoFormat
- java.lang.Object
-
- com.google.crypto.tink.CryptoFormat
-
public final class CryptoFormat extends java.lang.ObjectConstants and convenience methods that deal with crypto format.- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static intLEGACY_PREFIX_SIZELegacy or Crunchy prefix starts with \x00 and followed by a 4-byte key id.static byteLEGACY_START_BYTEstatic intNON_RAW_PREFIX_SIZEPrefix size of Tink, Legacy and Crunchy output prefix types.static byte[]RAW_PREFIXstatic intRAW_PREFIX_SIZERaw prefix is empty.static intTINK_PREFIX_SIZETink prefix starts with \x01 and followed by a 4-byte key id.static byteTINK_START_BYTE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getOutputPrefix(com.google.crypto.tink.proto.Keyset.Key key)Generates the prefix of all cryptographic outputs (ciphertexts, signatures, MACs, ...) produced by the specifiedkey.
-
-
-
Field Detail
-
NON_RAW_PREFIX_SIZE
public static final int NON_RAW_PREFIX_SIZE
Prefix size of Tink, Legacy and Crunchy output prefix types.- See Also:
- Constant Field Values
-
LEGACY_PREFIX_SIZE
public static final int LEGACY_PREFIX_SIZE
Legacy or Crunchy prefix starts with \x00 and followed by a 4-byte key id.- See Also:
- Constant Field Values
-
LEGACY_START_BYTE
public static final byte LEGACY_START_BYTE
- See Also:
- Constant Field Values
-
TINK_PREFIX_SIZE
public static final int TINK_PREFIX_SIZE
Tink prefix starts with \x01 and followed by a 4-byte key id.- See Also:
- Constant Field Values
-
TINK_START_BYTE
public static final byte TINK_START_BYTE
- See Also:
- Constant Field Values
-
RAW_PREFIX_SIZE
public static final int RAW_PREFIX_SIZE
Raw prefix is empty.- See Also:
- Constant Field Values
-
RAW_PREFIX
public static final byte[] RAW_PREFIX
-
-
Method Detail
-
getOutputPrefix
public static byte[] getOutputPrefix(com.google.crypto.tink.proto.Keyset.Key key) throws java.security.GeneralSecurityExceptionGenerates the prefix of all cryptographic outputs (ciphertexts, signatures, MACs, ...) produced by the specifiedkey. The prefix can be either empty (for RAW-type prefix), or consists of a 1-byte indicator of the type of the prefix, followed by 4 bytes ofkey.key_idin Big Endian encoding.- Returns:
- a prefix.
- Throws:
java.security.GeneralSecurityException- if the prefix type ofkeyis unknown.
-
-