Struct ockam_vault::SoftwareVault [−][src]
Vault implementation that stores secrets in memory and uses software crypto.
Examples
use ockam_vault::SoftwareVault; use ockam_vault_core::{SecretAttributes, SecretType, SecretPersistence, CURVE25519_SECRET_LENGTH, SecretVault, Signer, Verifier}; fn example() -> ockam_core::Result<()> { let mut vault = SoftwareVault::default(); let mut attributes = SecretAttributes::new( SecretType::Curve25519, SecretPersistence::Ephemeral, CURVE25519_SECRET_LENGTH, ); let secret = vault.secret_generate(attributes)?; let public = vault.secret_public_key_get(&secret)?; let data = "Very important stuff".as_bytes(); let signature = vault.sign(&secret, data)?; vault.verify(&signature, public.as_ref(), data) }
Implementations
impl SoftwareVault
[src]
Trait Implementations
impl AsymmetricVault for SoftwareVault
[src]
impl Debug for SoftwareVault
[src]
impl Default for SoftwareVault
[src]
impl Drop for SoftwareVault
[src]
impl Hasher for SoftwareVault
[src]
fn sha256(&self, data: &[u8]) -> Result<[u8; 32]>
[src]
fn hkdf_sha256(
&mut self,
salt: &Secret,
info: &[u8],
ikm: Option<&Secret>,
output_attributes: Vec<SecretAttributes>
) -> Result<Vec<Secret>>
[src]
&mut self,
salt: &Secret,
info: &[u8],
ikm: Option<&Secret>,
output_attributes: Vec<SecretAttributes>
) -> Result<Vec<Secret>>
Compute sha256. Salt and Ikm should be of Buffer type. Output secrets should be only of type Buffer or AES
impl KeyIdVault for SoftwareVault
[src]
fn get_secret_by_key_id(&self, key_id: &str) -> Result<Secret>
[src]
fn compute_key_id_for_public_key(&self, public_key: &PublicKey) -> Result<KeyId>
[src]
impl SecretVault for SoftwareVault
[src]
fn secret_generate(&mut self, attributes: SecretAttributes) -> Result<Secret>
[src]
Generate fresh secret. Only Curve25519 and Buffer types are supported
fn secret_import(
&mut self,
secret: &[u8],
attributes: SecretAttributes
) -> Result<Secret>
[src]
&mut self,
secret: &[u8],
attributes: SecretAttributes
) -> Result<Secret>
fn secret_export(&mut self, context: &Secret) -> Result<SecretKey>
[src]
fn secret_attributes_get(
&mut self,
context: &Secret
) -> Result<SecretAttributes>
[src]
&mut self,
context: &Secret
) -> Result<SecretAttributes>
fn secret_public_key_get(&mut self, context: &Secret) -> Result<PublicKey>
[src]
Extract public key from secret. Only Curve25519 type is supported
fn secret_destroy(&mut self, context: Secret) -> Result<()>
[src]
Remove secret from memory
impl Signer for SoftwareVault
[src]
fn sign(&mut self, secret_key: &Secret, data: &[u8]) -> Result<[u8; 64]>
[src]
Sign data with xeddsa algorithm. Only curve25519 is supported.
impl SymmetricVault for SoftwareVault
[src]
fn aead_aes_gcm_encrypt(
&mut self,
context: &Secret,
plaintext: &[u8],
nonce: &[u8],
aad: &[u8]
) -> Result<Buffer<u8>>
[src]
&mut self,
context: &Secret,
plaintext: &[u8],
nonce: &[u8],
aad: &[u8]
) -> Result<Buffer<u8>>
fn aead_aes_gcm_decrypt(
&mut self,
context: &Secret,
cipher_text: &[u8],
nonce: &[u8],
aad: &[u8]
) -> Result<Buffer<u8>>
[src]
&mut self,
context: &Secret,
cipher_text: &[u8],
nonce: &[u8],
aad: &[u8]
) -> Result<Buffer<u8>>
impl Verifier for SoftwareVault
[src]
fn verify(
&mut self,
signature: &[u8; 64],
public_key: &[u8],
data: &[u8]
) -> Result<()>
[src]
&mut self,
signature: &[u8; 64],
public_key: &[u8],
data: &[u8]
) -> Result<()>
Verify signature with xeddsa algorithm. Only curve25519 is supported.
impl Zeroize for SoftwareVault
[src]
Auto Trait Implementations
impl RefUnwindSafe for SoftwareVault
impl Send for SoftwareVault
impl Sync for SoftwareVault
impl Unpin for SoftwareVault
impl UnwindSafe for SoftwareVault
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,
pub 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.
pub 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.
pub 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>,