Class LegacyKeysetSerialization
- java.lang.Object
-
- com.google.crypto.tink.LegacyKeysetSerialization
-
public final class LegacyKeysetSerialization extends java.lang.ObjectParsing and Serialization methods for use withKeysetReaderandKeysetWriterclasses.In combination with a
BinaryKeysetReaderor aBinaryKeysetWriter, the methods in this file produce serializations compatible with the methods inTinkProtoKeysetFormat.In combination with a
JsonKeysetReaderor aJsonKeysetWriter, the methods in this file produce serializations compatible with the methods inTinkJsonProtoKeysetFormat.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.crypto.tink.proto.KeysetInfogetKeysetInfo(KeysetHandle handle)Returns theKeysetInfoproto of the givenKeysetHandle.static KeysetHandleparseEncryptedKeyset(KeysetReader reader, Aead aead, byte[] associatedData)Parse an encrypted keyset from the reader.static KeysetHandleparseKeyset(KeysetReader reader, SecretKeyAccess access)Parse a keyset from the reader.static KeysetHandleparseKeysetWithoutSecret(KeysetReader reader)Parse a KeysetHandle from the reader.static voidserializeEncryptedKeyset(KeysetHandle keysetHandle, KeysetWriter writer, Aead aead, byte[] associatedData)Serialize a keyset in an encrypted format to the writer.static voidserializeKeyset(KeysetHandle keysetHandle, KeysetWriter writer, SecretKeyAccess access)Serialize a keyset to the writer.static voidserializeKeysetWithoutSecret(KeysetHandle keysetHandle, KeysetWriter writer)Serialize a keyset to the writer.
-
-
-
Method Detail
-
parseKeysetWithoutSecret
public static KeysetHandle parseKeysetWithoutSecret(KeysetReader reader) throws java.security.GeneralSecurityException, java.io.IOException
Parse a KeysetHandle from the reader.This method is used for keysets containing no secret key material.
- Throws:
java.security.GeneralSecurityExceptionjava.io.IOException
-
parseKeyset
public static KeysetHandle parseKeyset(KeysetReader reader, SecretKeyAccess access) throws java.security.GeneralSecurityException, java.io.IOException
Parse a keyset from the reader.This is used to parse keysets that may contain secret key material. The second argument has to be
InsecureSecretKeyAccess.get().- Throws:
java.security.GeneralSecurityExceptionjava.io.IOException
-
parseEncryptedKeyset
public static KeysetHandle parseEncryptedKeyset(KeysetReader reader, Aead aead, byte[] associatedData) throws java.security.GeneralSecurityException, java.io.IOException
Parse an encrypted keyset from the reader.- Throws:
java.security.GeneralSecurityExceptionjava.io.IOException
-
serializeKeysetWithoutSecret
public static void serializeKeysetWithoutSecret(KeysetHandle keysetHandle, KeysetWriter writer) throws java.security.GeneralSecurityException, java.io.IOException
Serialize a keyset to the writer.This method is used for keysets containing no secret key material.
- Throws:
java.security.GeneralSecurityExceptionjava.io.IOException
-
serializeKeyset
public static void serializeKeyset(KeysetHandle keysetHandle, KeysetWriter writer, SecretKeyAccess access) throws java.io.IOException
Serialize a keyset to the writer.This method is used to serialize keysets that may contain secret key material. The last argument must be
InsecureSecretKeyAccess.get().- Throws:
java.io.IOException
-
serializeEncryptedKeyset
public static void serializeEncryptedKeyset(KeysetHandle keysetHandle, KeysetWriter writer, Aead aead, byte[] associatedData) throws java.security.GeneralSecurityException, java.io.IOException
Serialize a keyset in an encrypted format to the writer.- Throws:
java.security.GeneralSecurityExceptionjava.io.IOException
-
getKeysetInfo
public static com.google.crypto.tink.proto.KeysetInfo getKeysetInfo(KeysetHandle handle)
Returns theKeysetInfoproto of the givenKeysetHandle.Note: in most cases you can get more information by calling
handle.getAt(i).getKey()and casting the result to the appropriate key type.
-
-