Class SharedPrefKeysetReader
- java.lang.Object
-
- com.google.crypto.tink.integration.android.SharedPrefKeysetReader
-
- All Implemented Interfaces:
KeysetReader
public final class SharedPrefKeysetReader extends java.lang.Object implements KeysetReader
AKeysetReaderthat can read keysets from private shared preferences on Android.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description SharedPrefKeysetReader(android.content.Context context, java.lang.String keysetName, java.lang.String prefFilename)Creates aKeysetReaderthat reads and hex-decodes keysets from the preference namekeysetNamein the private shared preferences fileprefFilename.
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Constructor Detail
-
SharedPrefKeysetReader
public SharedPrefKeysetReader(android.content.Context context, java.lang.String keysetName, java.lang.String prefFilename) throws java.io.IOExceptionCreates aKeysetReaderthat reads and hex-decodes keysets from the preference namekeysetNamein the private shared preferences fileprefFilename.If
prefFilenameis null, uses the default shared preferences file.- Throws:
java.io.IOException- if cannot read the keysetjava.lang.IllegalArgumentException- ifkeysetNameis null
-
-
Method Detail
-
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
-
-