pub struct PrecalcSecretKey<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize>(/* private fields */);Expand description
Precalculated secret key for use with precalc_* functions in
crate::dryocbox::DryocBox.
You probably want to use precalc_* functions if you need to
encrypt/decrypt multiple messages between the same sender and receiver.
These functions save computation time by using PrecalcSecretKey
instead of computing the shared secret every time.
Using precalculated secret keys is compatible with libsodium’s
crypto_box_beforenm.
Implementations§
Source§impl PrecalcSecretKey<Locked<HeapByteArray<CRYPTO_BOX_PUBLICKEYBYTES>>>
impl PrecalcSecretKey<Locked<HeapByteArray<CRYPTO_BOX_PUBLICKEYBYTES>>>
Sourcepub fn precalculate_locked<ThirdPartyPublicKey: ByteArray<CRYPTO_BOX_PUBLICKEYBYTES>, SecretKey: ByteArray<CRYPTO_BOX_SECRETKEYBYTES>>(
third_party_public_key: &ThirdPartyPublicKey,
secret_key: &SecretKey,
) -> Result<Self, Error>
Available on crate feature nightly only.
pub fn precalculate_locked<ThirdPartyPublicKey: ByteArray<CRYPTO_BOX_PUBLICKEYBYTES>, SecretKey: ByteArray<CRYPTO_BOX_SECRETKEYBYTES>>( third_party_public_key: &ThirdPartyPublicKey, secret_key: &SecretKey, ) -> Result<Self, Error>
nightly only.Computes a heap-allocated, page-aligned, locked shared secret key
for the given third_party_public_key and secret_key.
Compatible with libsodium’s crypto_box_beforenm.
Source§impl PrecalcSecretKey<LockedRO<HeapByteArray<CRYPTO_BOX_PUBLICKEYBYTES>>>
impl PrecalcSecretKey<LockedRO<HeapByteArray<CRYPTO_BOX_PUBLICKEYBYTES>>>
Sourcepub fn precalculate_readonly_locked<ThirdPartyPublicKey: ByteArray<CRYPTO_BOX_PUBLICKEYBYTES>, SecretKey: ByteArray<CRYPTO_BOX_SECRETKEYBYTES>>(
third_party_public_key: &ThirdPartyPublicKey,
secret_key: &SecretKey,
) -> Result<Self, Error>
Available on crate feature nightly only.
pub fn precalculate_readonly_locked<ThirdPartyPublicKey: ByteArray<CRYPTO_BOX_PUBLICKEYBYTES>, SecretKey: ByteArray<CRYPTO_BOX_SECRETKEYBYTES>>( third_party_public_key: &ThirdPartyPublicKey, secret_key: &SecretKey, ) -> Result<Self, Error>
nightly only.Computes a heap-allocated, page-aligned, locked, read-only shared
secret key for the given third_party_public_key and
secret_key.
Compatible with libsodium’s crypto_box_beforenm.
Source§impl PrecalcSecretKey<StackByteArray<CRYPTO_BOX_BEFORENMBYTES>>
impl PrecalcSecretKey<StackByteArray<CRYPTO_BOX_BEFORENMBYTES>>
Sourcepub fn precalculate<ThirdPartyPublicKey: ByteArray<CRYPTO_BOX_PUBLICKEYBYTES>, SecretKey: ByteArray<CRYPTO_BOX_SECRETKEYBYTES>>(
third_party_public_key: &ThirdPartyPublicKey,
secret_key: &SecretKey,
) -> Self
pub fn precalculate<ThirdPartyPublicKey: ByteArray<CRYPTO_BOX_PUBLICKEYBYTES>, SecretKey: ByteArray<CRYPTO_BOX_SECRETKEYBYTES>>( third_party_public_key: &ThirdPartyPublicKey, secret_key: &SecretKey, ) -> Self
Computes a stack-allocated shared secret key for the given
third_party_public_key and secret_key.
Compatible with libsodium’s crypto_box_beforenm.
Trait Implementations§
Source§impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> ByteArray<CRYPTO_BOX_BEFORENMBYTES> for PrecalcSecretKey<InnerKey>
impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> ByteArray<CRYPTO_BOX_BEFORENMBYTES> for PrecalcSecretKey<InnerKey>
Source§impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Bytes + Zeroize> Bytes for PrecalcSecretKey<InnerKey>
impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Bytes + Zeroize> Bytes for PrecalcSecretKey<InnerKey>
Source§impl<InnerKey: Clone + ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Clone for PrecalcSecretKey<InnerKey>
impl<InnerKey: Clone + ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Clone for PrecalcSecretKey<InnerKey>
Source§fn clone(&self) -> PrecalcSecretKey<InnerKey>
fn clone(&self) -> PrecalcSecretKey<InnerKey>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<InnerKey: Debug + ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Debug for PrecalcSecretKey<InnerKey>
impl<InnerKey: Debug + ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Debug for PrecalcSecretKey<InnerKey>
Source§impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> DerefMut for PrecalcSecretKey<InnerKey>
impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> DerefMut for PrecalcSecretKey<InnerKey>
Source§impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Drop for PrecalcSecretKey<InnerKey>
impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Drop for PrecalcSecretKey<InnerKey>
Source§impl<InnerKey: MutByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> MutByteArray<CRYPTO_BOX_BEFORENMBYTES> for PrecalcSecretKey<InnerKey>
impl<InnerKey: MutByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> MutByteArray<CRYPTO_BOX_BEFORENMBYTES> for PrecalcSecretKey<InnerKey>
Source§fn as_mut_array(&mut self) -> &mut [u8; 32]
fn as_mut_array(&mut self) -> &mut [u8; 32]
Source§impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize + MutBytes> MutBytes for PrecalcSecretKey<InnerKey>
impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize + MutBytes> MutBytes for PrecalcSecretKey<InnerKey>
Source§fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Source§fn copy_from_slice(&mut self, other: &[u8])
fn copy_from_slice(&mut self, other: &[u8])
other. Panics if lengths do not
match.Source§impl<InnerKey: PartialEq + ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> PartialEq for PrecalcSecretKey<InnerKey>
impl<InnerKey: PartialEq + ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> PartialEq for PrecalcSecretKey<InnerKey>
Source§impl<InnerKey> Zeroize for PrecalcSecretKey<InnerKey>
impl<InnerKey> Zeroize for PrecalcSecretKey<InnerKey>
Source§impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Deref for PrecalcSecretKey<InnerKey>
impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Deref for PrecalcSecretKey<InnerKey>
impl<InnerKey: Eq + ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> Eq for PrecalcSecretKey<InnerKey>
impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Zeroize> StructuralPartialEq for PrecalcSecretKey<InnerKey>
Auto Trait Implementations§
impl<InnerKey> Freeze for PrecalcSecretKey<InnerKey>where
InnerKey: Freeze,
impl<InnerKey> RefUnwindSafe for PrecalcSecretKey<InnerKey>where
InnerKey: RefUnwindSafe,
impl<InnerKey> Send for PrecalcSecretKey<InnerKey>where
InnerKey: Send,
impl<InnerKey> Sync for PrecalcSecretKey<InnerKey>where
InnerKey: Sync,
impl<InnerKey> Unpin for PrecalcSecretKey<InnerKey>where
InnerKey: Unpin,
impl<InnerKey> UnwindSafe for PrecalcSecretKey<InnerKey>where
InnerKey: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
UnwrapMut wrapper.