pub fn valid_key_sizes(&self) -> Result<Vec<usize>> {
        let key_sizes_struct = self
            .handle
            .get_property::<BCRYPT_KEY_LENGTHS_STRUCT>(BCRYPT_KEY_LENGTHS)?;

        if key_sizes_struct.dwIncrement != 0 {
            Ok(
                (key_sizes_struct.dwMinLength as usize..=key_sizes_struct.dwMaxLength as usize)
                    .step_by(key_sizes_struct.dwIncrement as usize)
                    .collect(),
            )
        } else {
            Ok(vec![key_sizes_struct.dwMinLength as usize])
        }
    }
/// Returns a list of all the valid key sizes for an algorithm.
///
/// The key sizes are defined in bits.
///
/// # Examples
///
/// ```
/// # use win_crypto_ng::symmetric::{ChainingMode, SymmetricAlgorithm, SymmetricAlgorithmId};
/// let algo = SymmetricAlgorithm::open(SymmetricAlgorithmId::Aes, ChainingMode::Cbc).unwrap();
/// let valid_key_sizes = algo.valid_key_sizes().unwrap();
///
/// assert_eq!([128, 192, 256], valid_key_sizes.as_slice());
/// ```
Returns a list of all the valid key sizes for an algorithm.
The key sizes are defined in bits.
Returns a list of all the valid key sizes for an algorithm . The key sizes are defined in bits .
pub fn valid_key_sizes(&self) -> Result<Vec<usize>> {
        let key_sizes_struct = self
            .handle
            .get_property::<BCRYPT_KEY_LENGTHS_STRUCT>(BCRYPT_KEY_LENGTHS)?;
        if key_sizes_struct.dwIncrement != 0 {
            Ok(
                (key_sizes_struct.dwMinLength as usize..=key_sizes_struct.dwMaxLength as usize)
                    .step_by(key_sizes_struct.dwIncrement as usize)
                    .collect(),
            )
        } else {
            Ok(vec![key_sizes_struct.dwMinLength as usize])
        }
    }
pub fn valid_key_sizes ( & self ) -> Result < Vec < usize > > { let key_sizes_struct = self . handle . get_property :: < BCRYPT_KEY_LENGTHS_STRUCT > ( BCRYPT_KEY_LENGTHS ) ? ; if key_sizes_struct . dwIncrement != 0 { Ok ( ( key_sizes_struct . dwMinLength as usize ..= key_sizes_struct . dwMaxLength as usize ) . step_by ( key_sizes_struct . dwIncrement as usize ) . collect ( ) , ) } else { Ok ( vec ! [ key_sizes_struct dwMinLength as usize ] ) } }
Returns a list of all the valid key sizes for an algorithm.
Returns a list of all the valid key sizes for an algorithm .
&self
&self
examples
None
use win_crypto_ng::symmetric::{chainingmode, symmetricalgorithm, symmetricalgorithmid};
let algo = SymmetricAlgorithm::open(SymmetricAlgorithmId::Aes, ChainingMode::Cbc).unwrap();
let valid_key_sizes = algo.valid_key_sizes().unwrap().


let algo = SymmetricAlgorithm :: open ( SymmetricAlgorithmId :: Aes ChainingMode :: Cbc ) . unwrap () ; let valid_key_sizes = algo . valid_key_sizes () . unwrap () .