Skip to main content

KeyBlockHeader

Struct KeyBlockHeader 

Source
pub struct KeyBlockHeader { /* private fields */ }
Expand description

Represents a TR-31 key block header.

Implementations§

Source§

impl KeyBlockHeader

Source

pub fn new_empty() -> Self

Create a new empty key block header.

Source

pub fn new_with_values( version_id: &str, key_usage: &str, algorithm: &str, mode_of_use: &str, key_version_number: &str, exportability: &str, ) -> Result<Self, KeyBlockHeaderError>

Create a new key block header from individual header values.

Source

pub fn new_from_str(header_str: &str) -> Result<Self, KeyBlockHeaderError>

Parse a key block header from its string representation.

The input may contain additional key block data after the header. Optional blocks are parsed according to the number declared in the fixed header.

Source

pub fn export_str(&self) -> Result<String, KeyBlockHeaderError>

Export the key block header to its ASCII representation.

Source

pub fn set_version_id(&mut self, value: &str) -> Result<(), KeyBlockHeaderError>

Set the key block version identifier.

Source

pub fn version_id(&self) -> &str

Return the key block version identifier.

Source

pub fn set_kb_length(&mut self, value: u16) -> Result<(), KeyBlockHeaderError>

Set the complete key block length.

Source

pub fn kb_length(&self) -> u16

Return the complete key block length.

Source

pub fn set_key_usage(&mut self, value: &str) -> Result<(), KeyBlockHeaderError>

Set the key usage.

Source

pub fn key_usage(&self) -> &str

Return the key usage.

Source

pub fn set_algorithm(&mut self, value: &str) -> Result<(), KeyBlockHeaderError>

Set the protected-key algorithm.

Source

pub fn algorithm(&self) -> &str

Return the protected-key algorithm.

Source

pub fn set_mode_of_use( &mut self, value: &str, ) -> Result<(), KeyBlockHeaderError>

Set the key mode of use.

Source

pub fn mode_of_use(&self) -> &str

Return the key mode of use.

Source

pub fn set_key_version_number( &mut self, value: &str, ) -> Result<(), KeyBlockHeaderError>

Set the key version number.

Source

pub fn key_version_number(&self) -> &str

Return the key version number.

Source

pub fn set_exportability( &mut self, value: &str, ) -> Result<(), KeyBlockHeaderError>

Set the exportability attribute.

Source

pub fn exportability(&self) -> &str

Return the exportability attribute.

Source

pub fn set_num_optional_blocks( &mut self, value: u8, ) -> Result<(), KeyBlockHeaderError>

Set the number of optional blocks declared in the header.

Source

pub fn num_optional_blocks(&self) -> u8

Return the number of optional blocks declared in the header.

Source

pub fn set_reserved_field( &mut self, value: &str, ) -> Result<(), KeyBlockHeaderError>

Set the TR-31 reserved header field.

Source

pub fn reserved_field(&self) -> &str

Return the reserved header field.

Source

pub fn set_opt_blocks(&mut self, opt_blocks: Option<Box<OptBlock>>)

Replace the linked optional blocks and update their count.

Source

pub fn append_opt_blocks(&mut self, opt_block_to_append: OptBlock)

Append one or more optional blocks to the existing optional-block chain.

Source

pub fn opt_blocks(&self) -> &Option<Box<OptBlock>>

Return the optional-block chain.

Source

pub fn len(&self) -> usize

Return the complete encoded header length, including optional blocks.

Source

pub fn finalize(&mut self) -> Result<(), KeyBlockHeaderError>

Finalize the header by padding optional blocks to the cipher block boundary when required.

Trait Implementations§

Source§

impl Debug for KeyBlockHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for KeyBlockHeader

Source§

fn eq(&self, other: &KeyBlockHeader) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for KeyBlockHeader

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.