[−][src]Struct tink_core::keyset::Manager
Manager manages a Keyset
-proto, with convenience methods that rotate,
disable, enable or destroy keys. Note: It is not thread-safe.
Implementations
impl Manager
[src]
pub fn new() -> Self
[src]
Create a new instance with an empty Keyset
.
pub fn new_from_handle(kh: Handle) -> Self
[src]
Create a new instance from the given Handle
.
pub fn rotate(&mut self, kt: &KeyTemplate) -> Result<KeyId, TinkError>
[src]
Generate a fresh key using the given key template and set the new key as the primary key.
The key that was primary prior to rotation remains Enabled
. Returns the key ID of the
new primary key.
pub fn add(
&mut self,
kt: &KeyTemplate,
as_primary: bool
) -> Result<KeyId, TinkError>
[src]
&mut self,
kt: &KeyTemplate,
as_primary: bool
) -> Result<KeyId, TinkError>
Generate a fresh key using the given key template, and optionally set the new key as the primary key. Returns the key ID of the added key.
pub fn handle(&self) -> Result<Handle, TinkError>
[src]
Create a new Handle
for the managed keyset.
pub fn enable(&mut self, key_id: KeyId) -> Result<(), TinkError>
[src]
Sets the status of the specified key to KeyStatusType::Enabled
. Succeeds only if before
the call the specified key has status KeyStatusType::Disabled
or
KeyStatusType::Enabled
.
pub fn disable(&mut self, key_id: KeyId) -> Result<(), TinkError>
[src]
Sets the status of the specified key to KeyStatusType::Disabled
.
Succeeds only if before the call the specified key
is not primary and has status KeyStatusType::Disabled
or KeyStatusType::Enabled
.
pub fn destroy(&mut self, key_id: KeyId) -> Result<(), TinkError>
[src]
Sets the status of the specified key to KeyStatusType::Destroyed
, and removes the
corresponding key material, if any. Succeeds only if before the call the specified key
is not primary and has status KeyStatusType::Disabled
, or
KeyStatusType::Enabled
, or KeyStatusType::Destroyed
.
pub fn delete(&mut self, key_id: KeyId) -> Result<(), TinkError>
[src]
Removes the specifed key from the managed keyset. Succeeds only if the specified key is not primary. After deletion the keyset contains one key fewer.
pub fn set_primary(&mut self, key_id: KeyId) -> Result<(), TinkError>
[src]
Sets the specified key as the primary. Succeeds only if the specified key is Enabled
.
pub fn key_count(&self) -> usize
[src]
Return the count of all keys in the keyset.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl UnwindSafe for Manager
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,