Struct ockam_vault::SoftwareVault[][src]

pub struct SoftwareVault { /* fields omitted */ }

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)?;
    assert!(vault.verify(&signature, &public, data)?);

    Ok(())
}

Implementations

impl SoftwareVault[src]

pub fn error_domain_static() -> &'static str[src]

Return the error domain for this Vault

impl SoftwareVault[src]

pub fn new() -> Self[src]

Create a new SoftwareVault

Trait Implementations

impl AsymmetricVault for SoftwareVault[src]

impl Debug for SoftwareVault[src]

impl Default for SoftwareVault[src]

impl Drop for SoftwareVault[src]

impl ErrorVault for SoftwareVault[src]

impl Hasher for SoftwareVault[src]

fn hkdf_sha256(
    &mut self,
    salt: &Secret,
    info: &[u8],
    ikm: Option<&Secret>,
    output_attributes: Vec<SecretAttributes>
) -> Result<Vec<Secret>>
[src]

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]

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_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]

impl Verifier for SoftwareVault[src]

fn verify(
    &mut self,
    signature: &[u8; 64],
    public_key: &PublicKey,
    data: &[u8]
) -> Result<bool>
[src]

Verify signature with xeddsa algorithm. Only curve25519 is supported.

impl Zeroize for SoftwareVault[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,