Package com.helixframework.crypto.aead
Class AeadKeysetHandleFactory
java.lang.Object
com.helixframework.crypto.aead.AeadKeysetHandleFactory
Factory for creating keyset handles.
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.crypto.tink.KeysetHandlecreate()Generates a newKeysetHandle.com.google.crypto.tink.KeysetHandlefromBytes(byte[] keyBytes) Creates aKeysetHandleinstance from the supplied bytes.com.google.crypto.tink.KeysetHandleCreates aKeysetHandleinstance from the supplied JSON string.static AeadKeysetHandleFactoryGets the singleton instance of this factory.byte[]toBytes(com.google.crypto.tink.KeysetHandle keysetHandle) Converts the suppliedKeysetHandleto bytes.toJson(com.google.crypto.tink.KeysetHandle keysetHandle) Converts the suppliedKeysetHandleto a JSON string.
-
Method Details
-
getInstance
Gets the singleton instance of this factory.- Returns:
- a
AeadKeysetHandleFactoryinstance
-
create
Generates a newKeysetHandle.- Returns:
- a new keyset handle
- Throws:
GeneralSecurityException- if the keyset handle cannot be generated
-
toJson
Converts the suppliedKeysetHandleto a JSON string.- Parameters:
keysetHandle- keyset handle- Returns:
- a json string representation of the keyset handle
- Throws:
IOException- if the keyset handle cannot be converted to json
-
toBytes
Converts the suppliedKeysetHandleto bytes.- Parameters:
keysetHandle- keyset handle- Returns:
- a bytes representation of the keyset handle
- Throws:
IOException- if the keyset handle cannot be converted to json
-
fromBytes
public com.google.crypto.tink.KeysetHandle fromBytes(byte[] keyBytes) throws GeneralSecurityException, IOException Creates aKeysetHandleinstance from the supplied bytes.- Parameters:
keyBytes- key bytes- Returns:
- a
KeysetHandle - Throws:
GeneralSecurityException- if the keyset handle cannot be createdIOException- if there is an issue reading the bytes
-
fromJson
public com.google.crypto.tink.KeysetHandle fromJson(String keyJson) throws GeneralSecurityException, IOException Creates aKeysetHandleinstance from the supplied JSON string.- Parameters:
keyJson- key in JSON format- Returns:
- a
KeysetHandle - Throws:
GeneralSecurityException- if the keyset handle cannot be createdIOException- if there is an issue reading the json
-