public final class JsonKeysetReader extends Object implements KeysetReader
KeysetReader that can read from source source cleartext or encrypted keysets in proto
JSON format.| Modifier and Type | Method and Description |
|---|---|
com.google.crypto.tink.proto.Keyset |
read()
Tries to read and return a cleartext
Keyset. |
com.google.crypto.tink.proto.EncryptedKeyset |
readEncrypted()
Tries to read and return an
EncryptedKeyset. |
static JsonKeysetReader |
withBytes(byte[] bytes)
Static method to create a JsonKeysetReader from a byte array.
|
static JsonKeysetReader |
withFile(File file)
Static method to create a JsonKeysetReader from a file.
|
static KeysetReader |
withInputStream(InputStream input)
Static method to create a JsonKeysetReader from an
InputStream. |
static JsonKeysetReader |
withJsonObject(JSONObject input)
Static method to create a JsonKeysetReader from an
JSONObject. |
static JsonKeysetReader |
withPath(Path path)
Static method to create a JsonKeysetReader from a
Path. |
static JsonKeysetReader |
withPath(String path)
Static method to create a JsonKeysetReader from a
Path. |
static JsonKeysetReader |
withString(String input)
Static method to create a JsonKeysetReader from a string.
|
JsonKeysetReader |
withUrlSafeBase64() |
public static KeysetReader withInputStream(InputStream input) throws IOException
InputStream.
Note: the input stream won't be read until read() or readEncrypted() is called.
IOExceptionpublic static JsonKeysetReader withJsonObject(JSONObject input)
JSONObject.public static JsonKeysetReader withString(String input)
public static JsonKeysetReader withBytes(byte[] bytes)
public static JsonKeysetReader withFile(File file) throws IOException
Note: the file won't be read until read() or readEncrypted() is called.
IOExceptionpublic static JsonKeysetReader withPath(String path) throws IOException
Path.
Note: the file path won't be read until read() or readEncrypted() is called.
This method only works on Android API level 26 or newer.
IOExceptionpublic static JsonKeysetReader withPath(Path path) throws IOException
Path.
Note: the file path won't be read until read() or readEncrypted() is called.
This method only works on Android API level 26 or newer.
IOExceptionpublic JsonKeysetReader withUrlSafeBase64()
public com.google.crypto.tink.proto.Keyset read()
throws IOException
KeysetReaderKeyset.read in interface KeysetReaderIOExceptionpublic com.google.crypto.tink.proto.EncryptedKeyset readEncrypted()
throws IOException
KeysetReaderEncryptedKeyset.readEncrypted in interface KeysetReaderIOException