pub struct CryptoMetadata {
pub cek_table_ordinal: u16,
pub base_user_type: u32,
pub base_col_type: u8,
pub base_type_info: TypeInfo,
pub algorithm_id: u8,
pub encryption_type: EncryptionTypeWire,
pub normalization_version: u8,
}Expand description
Per-column encryption metadata.
This metadata is present for each encrypted column and describes how to decrypt the column data. Per MS-TDS 2.2.7.4, the wire format is:
ordinal(2) + base_user_type(4) + base_col_type(1) + base_type_info(var) + algo_id(1) + enc_type(1) + norm_ver(1)The base_col_type and base_type_info describe the plaintext column type.
The outer column metadata describes the ciphertext transport type (always BigVarBinary).
Fields§
§cek_table_ordinal: u16Index into the CEK table (0-based).
base_user_type: u32Base user type of the plaintext column.
base_col_type: u8Base column type byte of the plaintext column.
base_type_info: TypeInfoType-specific metadata for the plaintext column type.
algorithm_id: u8Encryption algorithm ID.
encryption_type: EncryptionTypeWireEncryption type (deterministic or randomized).
normalization_version: u8Normalization rule version.
Implementations§
Source§impl CryptoMetadata
impl CryptoMetadata
Sourcepub fn decode(src: &mut impl Buf) -> Result<Self, ProtocolError>
pub fn decode(src: &mut impl Buf) -> Result<Self, ProtocolError>
Decode crypto metadata from the wire format.
Per MS-TDS 2.2.7.4, the wire format is:
cek_table_ordinal: USHORT (2 bytes)
base_user_type: ULONG (4 bytes)
base_col_type: BYTE (1 byte)
base_type_info: TYPE_INFO (variable, depends on base_col_type)
algorithm_id: BYTE (1 byte)
encryption_type: BYTE (1 byte)
normalization_version: BYTE (1 byte)Sourcepub fn is_aead_aes_256(&self) -> bool
pub fn is_aead_aes_256(&self) -> bool
Check if this uses the standard AEAD algorithm.
Sourcepub fn is_deterministic(&self) -> bool
pub fn is_deterministic(&self) -> bool
Check if this uses deterministic encryption.
Sourcepub fn is_randomized(&self) -> bool
pub fn is_randomized(&self) -> bool
Check if this uses randomized encryption.
Sourcepub fn base_type_id(&self) -> TypeId
pub fn base_type_id(&self) -> TypeId
Get the TypeId of the base (plaintext) column type.
Trait Implementations§
Source§impl Clone for CryptoMetadata
impl Clone for CryptoMetadata
Source§fn clone(&self) -> CryptoMetadata
fn clone(&self) -> CryptoMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more