Class SerializationRegistry
- java.lang.Object
-
- com.google.crypto.tink.internal.SerializationRegistry
-
public final class SerializationRegistry extends java.lang.ObjectAllows registeringKeySerializer,KeyParser,ParametersSerializer, andParametersParserobjects, and parsing/serializing keys and key formats with such objects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSerializationRegistry.BuilderAllows building SerializationRegistry objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasParserForKey(ProtoKeySerialization serializedKey)Returns true if a parser for thisserializedKeyhas been registered.booleanhasParserForParameters(ProtoParametersSerialization serializedParameters)Returns true if a parser for thisserializedKeyhas been registered.<KeyT extends Key>
booleanhasSerializerForKey(KeyT key, java.lang.Class<?> serializationClass)Returns true if a parser for thisserializedKeyhas been registered.<ParametersT extends Parameters>
booleanhasSerializerForParameters(ParametersT parameters, java.lang.Class<?> serializationClass)Returns true if a parser for thisserializedKeyhas been registered.KeyparseKey(ProtoKeySerialization serializedKey, SecretKeyAccess access)Parses the given serialization into a Key.ParametersparseParameters(ProtoParametersSerialization serializedParameters)Parses the given serialization into a Parameters.<KeyT extends Key>
ProtoKeySerializationserializeKey(KeyT key, SecretKeyAccess access)Serializes a given Key into a "SerializationT" object.<ParametersT extends Parameters>
ProtoParametersSerializationserializeParameters(ParametersT parameters)Serializes a given Parameters object into a "SerializationT" object.
-
-
-
Method Detail
-
hasParserForKey
public boolean hasParserForKey(ProtoKeySerialization serializedKey)
Returns true if a parser for thisserializedKeyhas been registered.
-
parseKey
public Key parseKey(ProtoKeySerialization serializedKey, @Nullable SecretKeyAccess access) throws java.security.GeneralSecurityException
Parses the given serialization into a Key.This will look up a previously registered parser for the passed in
SerializationTclass, and the used object identifier (as indicated byserializedKey.getObjectIdentifier()), and then parse the object with this parsers.- Throws:
java.security.GeneralSecurityException
-
hasSerializerForKey
public <KeyT extends Key> boolean hasSerializerForKey(KeyT key, java.lang.Class<?> serializationClass)
Returns true if a parser for thisserializedKeyhas been registered.
-
serializeKey
public <KeyT extends Key> ProtoKeySerialization serializeKey(KeyT key, @Nullable SecretKeyAccess access) throws java.security.GeneralSecurityException
Serializes a given Key into a "SerializationT" object.This will look up a previously registered serializer for the requested
SerializationTclass and the passed in key type, and then call serializeKey on the result.- Throws:
java.security.GeneralSecurityException
-
hasParserForParameters
public boolean hasParserForParameters(ProtoParametersSerialization serializedParameters)
Returns true if a parser for thisserializedKeyhas been registered.
-
parseParameters
public Parameters parseParameters(ProtoParametersSerialization serializedParameters) throws java.security.GeneralSecurityException
Parses the given serialization into a Parameters.This will look up a previously registered parser for the passed in
SerializationTclass, and the used object identifier (as indicated byserializedKey.getObjectIdentifier()), and then parse the object with this parsers.- Throws:
java.security.GeneralSecurityException
-
hasSerializerForParameters
public <ParametersT extends Parameters> boolean hasSerializerForParameters(ParametersT parameters, java.lang.Class<?> serializationClass)
Returns true if a parser for thisserializedKeyhas been registered.
-
serializeParameters
public <ParametersT extends Parameters> ProtoParametersSerialization serializeParameters(ParametersT parameters) throws java.security.GeneralSecurityException
Serializes a given Parameters object into a "SerializationT" object.This will look up a previously registered serializer for the requested
SerializationTclass and the passed in key type, and then call serializeKey on the result.- Throws:
java.security.GeneralSecurityException
-
-