Struct ockam_vault::SoftwareVault[][src]

pub struct SoftwareVault { /* fields omitted */ }
Expand description

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

Create a new SoftwareVault

Trait Implementations

Compute Elliptic-Curve Diffie-Hellman using this secret key and the specified uncompressed public key Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Compute sha256. Salt and Ikm should be of Buffer type. Output secrets should be only of type Buffer or AES

Compute the SHA-256 digest given input data

Return Secret for given key id

Return KeyId for given public key

Generate fresh secret. Only Curve25519 and Buffer types are supported

Extract public key from secret. Only Curve25519 type is supported

Remove secret from memory

Import a secret with given attributes from binary form into the vault

Export a secret key to the binary form represented as SecretKey

Get the attributes for a secret

Sign data with xeddsa algorithm. Only curve25519 is supported.

Encrypt a payload using AES-GCM

Decrypt a payload using AES-GCM

Verify signature with xeddsa algorithm. Only curve25519 is supported.

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.