pub struct Key<V: HasKey<K>, K: KeyType>(/* private fields */);Expand description
Generic key type.
Implementations§
Source§impl<V: SealingVersion<Public>> Key<V, Secret>
impl<V: SealingVersion<Public>> Key<V, Secret>
Sourcepub fn random() -> Result<Self, PasetoError>
pub fn random() -> Result<Self, PasetoError>
Generate a random secret key
Sourcepub fn public_key(&self) -> PublicKey<V>
pub fn public_key(&self) -> PublicKey<V>
Derive the associated public key
Source§impl<V: SealingVersion<Local>> Key<V, Local>
impl<V: SealingVersion<Local>> Key<V, Local>
Sourcepub fn random() -> Result<Self, PasetoError>
pub fn random() -> Result<Self, PasetoError>
Generate a random local key
Source§impl<V: PieWrapVersion + HasKey<K>, K: SealingKey> Key<V, K>
impl<V: PieWrapVersion + HasKey<K>, K: SealingKey> Key<V, K>
pub fn wrap_pie( self, with: &LocalKey<V>, ) -> Result<PieWrappedKey<V, K>, PasetoError>
Source§impl<V: PkeSealingVersion> Key<V, Local>
impl<V: PkeSealingVersion> Key<V, Local>
Source§impl<V: HasKey<K>, K: KeyType> Key<V, K>
impl<V: HasKey<K>, K: KeyType> Key<V, K>
Sourcepub fn expose_key(&self) -> KeyText<V, K>
pub fn expose_key(&self) -> KeyText<V, K>
Expose the key data such that it can be serialized.
Be advised that serializing key data can be dangerous. Make sure they are saved on secure disks or sent on secure connections only.
Source§impl<V: PwWrapVersion + HasKey<K>, K: SealingKey> Key<V, K>
impl<V: PwWrapVersion + HasKey<K>, K: SealingKey> Key<V, K>
Sourcepub fn password_wrap(
self,
pass: &[u8],
) -> Result<PasswordWrappedKey<V, K>, PasetoError>
pub fn password_wrap( self, pass: &[u8], ) -> Result<PasswordWrappedKey<V, K>, PasetoError>
Encrypt the key using the password.
Sourcepub fn password_wrap_with_params(
self,
pass: &[u8],
params: &V::Params,
) -> Result<PasswordWrappedKey<V, K>, PasetoError>
pub fn password_wrap_with_params( self, pass: &[u8], params: &V::Params, ) -> Result<PasswordWrappedKey<V, K>, PasetoError>
Encrypt the key using the password, configured with the specified parameters.
Trait Implementations§
Auto Trait Implementations§
impl<V, K> Freeze for Key<V, K>
impl<V, K> RefUnwindSafe for Key<V, K>
impl<V, K> Send for Key<V, K>
impl<V, K> Sync for Key<V, K>
impl<V, K> Unpin for Key<V, K>
impl<V, K> UnwindSafe for Key<V, K>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more