public interface KeyManager<P>
A key type is identified by the global name of the protocol buffer that holds the
corresponding key material, and is given by typeUrl-field of KeyData-protocol
buffer.
The template parameter P denotes the primitive corresponding to the keys handled by
this manager.
| Modifier and Type | Method and Description |
|---|---|
boolean |
doesSupport(String typeUrl) |
String |
getKeyType() |
P |
getPrimitive(com.google.protobuf.ByteString serializedKey)
Constructs an instance of P for the key given in
serializedKey, which must be a
serialized key protocol buffer handled by this manager. |
P |
getPrimitive(com.google.protobuf.MessageLite key)
Constructs an instance of P for the key given in
key. |
Class<P> |
getPrimitiveClass()
Returns the primitive class object of the P.
|
int |
getVersion() |
com.google.protobuf.MessageLite |
newKey(com.google.protobuf.ByteString serializedKeyFormat)
Generates a new key according to specification in
serializedKeyFormat, which must be a
serialized key format protocol buffer handled by this manager. |
com.google.protobuf.MessageLite |
newKey(com.google.protobuf.MessageLite keyFormat)
Generates a new key according to specification in
keyFormat. |
KeyData |
newKeyData(com.google.protobuf.ByteString serializedKeyFormat)
Generates a new
KeyData according to specification in serializedkeyFormat. |
P getPrimitive(com.google.protobuf.ByteString serializedKey) throws GeneralSecurityException
serializedKey, which must be a
serialized key protocol buffer handled by this manager.
For primitives of type Mac, Aead, PublicKeySign, PublicKeyVerify, DeterministicAead, HybridEncrypt, and HybridDecrypt
this should be a primitive which ignores the output prefix and assumes "RAW".
GeneralSecurityException - if the key given in serializedKey is corrupted or not
supportedP getPrimitive(com.google.protobuf.MessageLite key) throws GeneralSecurityException
key.
For primitives of type Mac, Aead, PublicKeySign, PublicKeyVerify, DeterministicAead, HybridEncrypt, and HybridDecrypt
this should be a primitive which ignores the output prefix and assumes "RAW".
GeneralSecurityException - if the key given in key is corrupted or not supportedcom.google.protobuf.MessageLite newKey(com.google.protobuf.ByteString serializedKeyFormat)
throws GeneralSecurityException
serializedKeyFormat, which must be a
serialized key format protocol buffer handled by this manager.GeneralSecurityException - if the specified format is wrong or not supportedcom.google.protobuf.MessageLite newKey(com.google.protobuf.MessageLite keyFormat)
throws GeneralSecurityException
keyFormat.GeneralSecurityException - if the specified format is wrong or not supportedboolean doesSupport(String typeUrl)
typeUrl.String getKeyType()
int getVersion()
Class<P> getPrimitiveClass()
return P.class;
when implementing a key manager for primitive {$code P}.P.classKeyData newKeyData(com.google.protobuf.ByteString serializedKeyFormat) throws GeneralSecurityException
KeyData according to specification in serializedkeyFormat.
This should be used solely by KeysetManager.
GeneralSecurityException - if the specified format is wrong or not supported