[−][src]Trait tink_core::registry::KeyManager
KeyManager
"understands" keys of a specific key types: it can generate keys of a supported
type and create primitives for supported keys. A key type is identified by the global name of
the protocol buffer that holds the corresponding key material, and is given by type_url
-field
of KeyData
-protocol buffer.
Required methods
fn primitive(&self, serialized_key: &[u8]) -> Result<Primitive, TinkError>
Construct a primitive instance for the key given in serialized_key
, which must be a
serialized key protocol buffer handled by this manager.
fn new_key(&self, serialized_key_format: &[u8]) -> Result<Vec<u8>, TinkError>
Generate a new key according to specification in serialized_key_format
, which must be
supported by this manager, returned as a serialized protocol buffer.
fn type_url(&self) -> &'static str
Return the type URL that identifes the key type of keys managed by this key manager.
fn key_material_type(&self) -> KeyMaterialType
Return the key material type handled by this key manager
Provided methods
fn does_support(&self, type_url: &str) -> bool
Return true iff this KeyManager
supports key type identified by type_url
.
fn new_key_data(
&self,
serialized_key_format: &[u8]
) -> Result<KeyData, TinkError>
&self,
serialized_key_format: &[u8]
) -> Result<KeyData, TinkError>
Generate a new KeyData
according to specification in
serialized_key_format
. This should be used solely by the key management API.
fn supports_private_keys(&self) -> bool
Indicate whether this KeyManager
understands private key types.
fn public_key_data(&self, _serialized_key: &[u8]) -> Result<KeyData, TinkError>
Extract the public key data from the private key. If supports_private_keys
returns
false, this method will always return an error.