Struct fog_crypto::lock::LockId
source · [−]pub struct LockId { /* private fields */ }
Expand description
An identifier for a corresponding LockKey
that can be used to encrypt data for that key.
This contains a cryptographic public encryption key.
Example
// We've been given a LockId that we're sending encrypted data to.
println!("LockId(Base58): {}", key.id());
// Encrypt some data for that LockId
let data = b"I am sensitive information, about to be encrypted";
let lockbox = id.encrypt_data(&mut csprng, data.as_ref());
// The lockbox can be encoded onto a vec or used as raw bytes.
let mut to_send = Vec::new();
to_send.extend_from_slice(lockbox.as_bytes());
Implementations
pub fn encrypt_data<R>(&self, csprng: &mut R, content: &[u8]) -> DataLockbox where
R: CryptoRng + RngCore,
pub fn encrypt_data<R>(&self, csprng: &mut R, content: &[u8]) -> DataLockbox where
R: CryptoRng + RngCore,
Encrypt a byte slice into a DataLockbox
. Requires a cryptographic RNG to generate the
needed nonce.
Get the raw public encryption key contained within.
Convert into a byte vector. For extending an existing byte vector, see
encode_vec
.
Attempt to parse a base58-encoded LockId
.
Encode onto an existing byte vector. Writes out the version followed by the public signing key. It does not include any length information in the encoding.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for LockId
impl UnwindSafe for LockId
Blanket Implementations
Mutably borrows from an owned value. Read more