Package com.google.crypto.tink
Class JsonKeysetReader
- java.lang.Object
-
- com.google.crypto.tink.JsonKeysetReader
-
- All Implemented Interfaces:
KeysetReader
public final class JsonKeysetReader extends java.lang.Object implements KeysetReader
AKeysetReaderthat can read from source source cleartext or encrypted keysets in proto JSON format.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.google.crypto.tink.proto.Keysetread()Tries to read and return a cleartextKeyset.com.google.crypto.tink.proto.EncryptedKeysetreadEncrypted()Tries to read and return anEncryptedKeyset.static JsonKeysetReaderwithBytes(byte[] bytes)Deprecated.Use TinkJsonProtoKeysetFormat.parseKeyset() instead.static JsonKeysetReaderwithFile(java.io.File file)Deprecated.Method should be inlined.static JsonKeysetReaderwithInputStream(java.io.InputStream input)Static method to create a JsonKeysetReader from anInputStream.static JsonKeysetReaderwithJsonObject(java.lang.Object input)Deprecated.Use#withStringstatic JsonKeysetReaderwithPath(java.lang.String path)Deprecated.Method should be inlined.static JsonKeysetReaderwithPath(java.nio.file.Path path)Deprecated.Method should be inlined.static JsonKeysetReaderwithString(java.lang.String input)Static method to create a JsonKeysetReader from a string.JsonKeysetReaderwithUrlSafeBase64()
-
-
-
Method Detail
-
withInputStream
public static JsonKeysetReader withInputStream(java.io.InputStream input) throws java.io.IOException
Static method to create a JsonKeysetReader from anInputStream.Note: the input stream won't be read until
read()orreadEncrypted()is called.- Throws:
java.io.IOException
-
withJsonObject
@InlineMe(replacement="JsonKeysetReader.withString(input.toString())", imports="com.google.crypto.tink.JsonKeysetReader") @Deprecated public static JsonKeysetReader withJsonObject(java.lang.Object input)Deprecated.Use#withStringStatic method to create a JsonKeysetReader from anJsonObject.
-
withString
public static JsonKeysetReader withString(java.lang.String input)
Static method to create a JsonKeysetReader from a string.
-
withBytes
@Deprecated public static JsonKeysetReader withBytes(byte[] bytes)
Deprecated.Use TinkJsonProtoKeysetFormat.parseKeyset() instead.Static method to create a JsonKeysetReader from a byte array.
-
withFile
@InlineMe(replacement="JsonKeysetReader.withInputStream(new FileInputStream(file))", imports={"com.google.crypto.tink.JsonKeysetReader","java.io.FileInputStream"}) @Deprecated public static JsonKeysetReader withFile(java.io.File file) throws java.io.IOExceptionDeprecated.Method should be inlined.Static method to create a JsonKeysetReader from a file.Note: the file won't be read until
read()orreadEncrypted()is called.- Throws:
java.io.IOException
-
withPath
@InlineMe(replacement="JsonKeysetReader.withInputStream(new FileInputStream(new File(path)))", imports={"com.google.crypto.tink.JsonKeysetReader","java.io.File","java.io.FileInputStream"}) @Deprecated public static JsonKeysetReader withPath(java.lang.String path) throws java.io.IOExceptionDeprecated.Method should be inlined.Static method to create a JsonKeysetReader from aPath.Note: the file path won't be read until
read()orreadEncrypted()is called.This method only works on Android API level 26 or newer.
- Throws:
java.io.IOException
-
withPath
@InlineMe(replacement="JsonKeysetReader.withInputStream(new FileInputStream(path.toFile()))", imports={"com.google.crypto.tink.JsonKeysetReader","java.io.FileInputStream"}) @Deprecated public static JsonKeysetReader withPath(java.nio.file.Path path) throws java.io.IOExceptionDeprecated.Method should be inlined.Static method to create a JsonKeysetReader from aPath.Note: the file path won't be read until
read()orreadEncrypted()is called.This method only works on Android API level 26 or newer.
- Throws:
java.io.IOException
-
withUrlSafeBase64
@CanIgnoreReturnValue public JsonKeysetReader withUrlSafeBase64()
-
read
public com.google.crypto.tink.proto.Keyset read() throws java.io.IOExceptionDescription copied from interface:KeysetReaderTries to read and return a cleartextKeyset.- Specified by:
readin interfaceKeysetReader- Returns:
- the Keyset
- Throws:
java.io.IOException
-
readEncrypted
public com.google.crypto.tink.proto.EncryptedKeyset readEncrypted() throws java.io.IOExceptionDescription copied from interface:KeysetReaderTries to read and return anEncryptedKeyset.- Specified by:
readEncryptedin interfaceKeysetReader- Returns:
- the EncryptedKeyset
- Throws:
java.io.IOException
-
-