Struct win_crypto_ng::helpers::Blob
source · #[repr(C, packed)]pub struct Blob<T: BlobLayout>(_, _);
Expand description
C-compatible dynamic inline structure.
Can be used to house data with a header structure of a statically known size but with trailing data of size dependent on the header field values.
Layout
The structure is marked as #[repr(C, packed)]
to be layout-compatible with
regular byte slice ([u8]
) since it’s mostly constructed from Box<[u8]>
via C FFI.
It’s worth noting that heap allocation will often align to pointer size, so no unaligned load should happen once the value is constructed from heap-allocated bytes.
Implementations§
source§impl Blob<DsaParameter>
impl Blob<DsaParameter>
sourcepub fn clone_from_parts(
header: &BCRYPT_DSA_PARAMETER_HEADER,
tail: &DsaParameterViewTail<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DSA_PARAMETER_HEADER, tail: &DsaParameterViewTail<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<DsaParameter>
impl Blob<DsaParameter>
source§impl Blob<DsaParameterV2>
impl Blob<DsaParameterV2>
sourcepub fn clone_from_parts(
header: &BCRYPT_DSA_PARAMETER_HEADER_V2,
tail: &DsaParameterV2ViewTail<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DSA_PARAMETER_HEADER_V2, tail: &DsaParameterV2ViewTail<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<DsaParameterV2>
impl Blob<DsaParameterV2>
source§impl Blob<DhParameter>
impl Blob<DhParameter>
sourcepub fn clone_from_parts(
header: &BCRYPT_DH_PARAMETER_HEADER,
tail: &DhParameterViewTail<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DH_PARAMETER_HEADER, tail: &DhParameterViewTail<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<DhParameter>
impl Blob<DhParameter>
source§impl<T> Blob<T>where
T: BlobLayout + KeyBlob,
impl<T> Blob<T>where T: BlobLayout + KeyBlob,
source§impl Blob<ErasedKeyBlob>
impl Blob<ErasedKeyBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_KEY_BLOB,
tail: &ErasedKeyPayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_KEY_BLOB, tail: &ErasedKeyPayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<RsaKeyPublicBlob>
impl Blob<RsaKeyPublicBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_RSAKEY_BLOB,
tail: &RsaKeyPublicPayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_RSAKEY_BLOB, tail: &RsaKeyPublicPayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<RsaKeyPublicBlob>
impl Blob<RsaKeyPublicBlob>
source§impl Blob<RsaKeyPrivateBlob>
impl Blob<RsaKeyPrivateBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_RSAKEY_BLOB,
tail: &RsaKeyPrivatePayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_RSAKEY_BLOB, tail: &RsaKeyPrivatePayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<RsaKeyPrivateBlob>
impl Blob<RsaKeyPrivateBlob>
source§impl Blob<RsaKeyFullPrivateBlob>
impl Blob<RsaKeyFullPrivateBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_RSAKEY_BLOB,
tail: &RsaKeyFullPrivatePayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_RSAKEY_BLOB, tail: &RsaKeyFullPrivatePayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<RsaKeyFullPrivateBlob>
impl Blob<RsaKeyFullPrivateBlob>
pub fn pub_exp(&self) -> &[u8] ⓘ
pub fn modulus(&self) -> &[u8] ⓘ
pub fn prime1(&self) -> &[u8] ⓘ
pub fn prime2(&self) -> &[u8] ⓘ
pub fn exponent1(&self) -> &[u8] ⓘ
pub fn exponent2(&self) -> &[u8] ⓘ
pub fn coeff(&self) -> &[u8] ⓘ
pub fn priv_exp(&self) -> &[u8] ⓘ
source§impl Blob<DhKeyPublicBlob>
impl Blob<DhKeyPublicBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_DH_KEY_BLOB,
tail: &DhKeyPublicPayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DH_KEY_BLOB, tail: &DhKeyPublicPayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<DhKeyPublicBlob>
impl Blob<DhKeyPublicBlob>
source§impl Blob<DhKeyPrivateBlob>
impl Blob<DhKeyPrivateBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_DH_KEY_BLOB,
tail: &DhKeyPrivatePayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DH_KEY_BLOB, tail: &DhKeyPrivatePayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<DhKeyPrivateBlob>
impl Blob<DhKeyPrivateBlob>
source§impl Blob<DsaKeyPublicBlob>
impl Blob<DsaKeyPublicBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_DSA_KEY_BLOB,
tail: &DsaKeyPublicPayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DSA_KEY_BLOB, tail: &DsaKeyPublicPayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<DsaKeyPublicBlob>
impl Blob<DsaKeyPublicBlob>
source§impl Blob<DsaKeyPrivateBlob>
impl Blob<DsaKeyPrivateBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_DSA_KEY_BLOB,
tail: &DsaKeyPrivatePayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DSA_KEY_BLOB, tail: &DsaKeyPrivatePayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<DsaKeyPrivateBlob>
impl Blob<DsaKeyPrivateBlob>
source§impl Blob<DsaKeyPublicV2Blob>
impl Blob<DsaKeyPublicV2Blob>
sourcepub fn clone_from_parts(
header: &BCRYPT_DSA_KEY_BLOB_V2,
tail: &DsaKeyPublicV2Payload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DSA_KEY_BLOB_V2, tail: &DsaKeyPublicV2Payload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<DsaKeyPrivateV2Blob>
impl Blob<DsaKeyPrivateV2Blob>
sourcepub fn clone_from_parts(
header: &BCRYPT_DSA_KEY_BLOB_V2,
tail: &DsaKeyPrivateV2Payload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_DSA_KEY_BLOB_V2, tail: &DsaKeyPrivateV2Payload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<EccKeyPublicBlob>
impl Blob<EccKeyPublicBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_ECCKEY_BLOB,
tail: &EccKeyPublicPayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_ECCKEY_BLOB, tail: &EccKeyPublicPayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.
source§impl Blob<EccKeyPrivateBlob>
impl Blob<EccKeyPrivateBlob>
sourcepub fn clone_from_parts(
header: &BCRYPT_ECCKEY_BLOB,
tail: &EccKeyPrivatePayload<'_>
) -> Box<Self>
pub fn clone_from_parts( header: &BCRYPT_ECCKEY_BLOB, tail: &EccKeyPrivatePayload<'_> ) -> Box<Self>
Create a [$wrapper_ident
] blob instance from its parts.
SAFETY: The header might contain length information about the payload
(i.e. the tail
argument). An mismatch between the two won’t cause a
memory corruption, but it will panic. Careful validation of the
arguments must be done to ensure proper behaviour.