public final class LegacyKeysetSerialization extends Object
KeysetReader and KeysetWriter
classes.
In combination with a BinaryKeysetReader or a BinaryKeysetWriter, the methods
in this file produce serializations compatible with the methods in TinkProtoKeysetFormat.
In combination with a JsonKeysetReader or a JsonKeysetWriter, the methods in
this file produce serializations compatible with the methods in TinkJsonProtoKeysetFormat.
| Modifier and Type | Method and Description |
|---|---|
static KeysetInfo |
getKeysetInfo(KeysetHandle handle)
Returns the
KeysetInfo proto of the given KeysetHandle. |
static KeysetHandle |
parseEncryptedKeyset(KeysetReader reader,
Aead aead,
byte[] associatedData)
Parse an encrypted keyset from the reader.
|
static KeysetHandle |
parseKeyset(KeysetReader reader,
SecretKeyAccess access)
Parse a keyset from the reader.
|
static KeysetHandle |
parseKeysetWithoutSecret(KeysetReader reader)
Parse a KeysetHandle from the reader.
|
static void |
serializeEncryptedKeyset(KeysetHandle keysetHandle,
KeysetWriter writer,
Aead aead,
byte[] associatedData)
Serialize a keyset in an encrypted format to the writer.
|
static void |
serializeKeyset(KeysetHandle keysetHandle,
KeysetWriter writer,
SecretKeyAccess access)
Serialize a keyset to the writer.
|
static void |
serializeKeysetWithoutSecret(KeysetHandle keysetHandle,
KeysetWriter writer)
Serialize a keyset to the writer.
|
public static KeysetHandle parseKeysetWithoutSecret(KeysetReader reader) throws GeneralSecurityException, IOException
This method is used for keysets containing no secret key material.
GeneralSecurityExceptionIOExceptionpublic static KeysetHandle parseKeyset(KeysetReader reader, SecretKeyAccess access) throws GeneralSecurityException, IOException
This is used to parse keysets that may contain secret key material. The second argument has
to be InsecureSecretKeyAccess.get().
GeneralSecurityExceptionIOExceptionpublic static KeysetHandle parseEncryptedKeyset(KeysetReader reader, Aead aead, byte[] associatedData) throws GeneralSecurityException, IOException
GeneralSecurityExceptionIOExceptionpublic static void serializeKeysetWithoutSecret(KeysetHandle keysetHandle, KeysetWriter writer) throws GeneralSecurityException, IOException
This method is used for keysets containing no secret key material.
GeneralSecurityExceptionIOExceptionpublic static void serializeKeyset(KeysetHandle keysetHandle, KeysetWriter writer, SecretKeyAccess access) throws IOException
This method is used to serialize keysets that may contain secret key material. The last
argument must be InsecureSecretKeyAccess.get().
IOExceptionpublic static void serializeEncryptedKeyset(KeysetHandle keysetHandle, KeysetWriter writer, Aead aead, byte[] associatedData) throws GeneralSecurityException, IOException
GeneralSecurityExceptionIOExceptionpublic static KeysetInfo getKeysetInfo(KeysetHandle handle)
KeysetInfo proto of the given KeysetHandle.
Note: in most cases you can get more information by calling handle.getAt(i).getKey()
and casting the result to the appropriate key type.