@Alpha public class PrivateKeyManagerImpl<PrimitiveT,KeyProtoT extends com.google.protobuf.MessageLite,PublicKeyProtoT extends com.google.protobuf.MessageLite> extends Object implements PrivateKeyManager<PrimitiveT>
PrivateKeyManager interface based on an PrivateKeyTypeManager and the corresponding public key manager, implemented by an KeyTypeManager.
Choosing PrimitiveT equal to Void is valid; in this case the
functions getPrimitive(com.google.protobuf.ByteString) will throw if invoked.
TODO(tholenst) Reduce visibility to package visible once all managers have been migrated.
| Constructor and Description |
|---|
PrivateKeyManagerImpl(PrivateKeyTypeManager<KeyProtoT,PublicKeyProtoT> privateKeyManager,
KeyTypeManager<PublicKeyProtoT> publicKeyManager,
Class<PrimitiveT> primitiveClass) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
doesSupport(String typeUrl) |
String |
getKeyType() |
PrimitiveT |
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. |
PrimitiveT |
getPrimitive(com.google.protobuf.MessageLite key)
Constructs an instance of P for the key given in
key. |
Class<PrimitiveT> |
getPrimitiveClass()
Returns the primitive class object of the P.
|
com.google.crypto.tink.proto.KeyData |
getPublicKeyData(com.google.protobuf.ByteString serializedKey)
Extracts the public key data from the private key data.
|
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. |
com.google.crypto.tink.proto.KeyData |
newKeyData(com.google.protobuf.ByteString serializedKeyFormat)
Generates a new
KeyData according to specification in serializedkeyFormat. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdoesSupport, getKeyType, getPrimitive, getPrimitive, getPrimitiveClass, getVersion, newKey, newKey, newKeyDatapublic PrivateKeyManagerImpl(PrivateKeyTypeManager<KeyProtoT,PublicKeyProtoT> privateKeyManager, KeyTypeManager<PublicKeyProtoT> publicKeyManager, Class<PrimitiveT> primitiveClass)
public com.google.crypto.tink.proto.KeyData getPublicKeyData(com.google.protobuf.ByteString serializedKey)
throws GeneralSecurityException
PrivateKeyManagergetPublicKeyData in interface PrivateKeyManager<PrimitiveT>KeyData containing the public keysGeneralSecurityException - if the specified format is wrong or not supportedpublic final PrimitiveT getPrimitive(com.google.protobuf.ByteString serializedKey)
throws GeneralSecurityException
KeyManagerserializedKey, which must be a
serialized key protocol buffer handled by this manager.getPrimitive in interface KeyManager<PrimitiveT>GeneralSecurityException - if the key given in serializedKey is corrupted or not
supportedpublic final PrimitiveT getPrimitive(com.google.protobuf.MessageLite key)
throws GeneralSecurityException
KeyManagerkey.getPrimitive in interface KeyManager<PrimitiveT>GeneralSecurityException - if the key given in key is corrupted or not supportedpublic final com.google.protobuf.MessageLite newKey(com.google.protobuf.ByteString serializedKeyFormat)
throws GeneralSecurityException
KeyManagerserializedKeyFormat, which must be a
serialized key format protocol buffer handled by this manager.newKey in interface KeyManager<PrimitiveT>GeneralSecurityException - if the specified format is wrong or not supportedpublic final com.google.protobuf.MessageLite newKey(com.google.protobuf.MessageLite keyFormat)
throws GeneralSecurityException
KeyManagerkeyFormat.newKey in interface KeyManager<PrimitiveT>GeneralSecurityException - if the specified format is wrong or not supportedpublic final boolean doesSupport(String typeUrl)
doesSupport in interface KeyManager<PrimitiveT>typeUrl.public final String getKeyType()
getKeyType in interface KeyManager<PrimitiveT>public int getVersion()
getVersion in interface KeyManager<PrimitiveT>public final com.google.crypto.tink.proto.KeyData newKeyData(com.google.protobuf.ByteString serializedKeyFormat)
throws GeneralSecurityException
KeyManagerKeyData according to specification in serializedkeyFormat.
This should be used solely by KeysetManager.
newKeyData in interface KeyManager<PrimitiveT>GeneralSecurityException - if the specified format is wrong or not supportedpublic final Class<PrimitiveT> getPrimitiveClass()
KeyManagerreturn P.class;
when implementing a key manager for primitive {$code P}.getPrimitiveClass in interface KeyManager<PrimitiveT>P.class