pub fn new_key(&self, secret: &[u8]) -> Result<SymmetricAlgorithmKey> {
        let object_size = self.handle.get_property::<DWORD>(BCRYPT_OBJECT_LENGTH)? as usize;

        let mut key_handle = KeyHandle::new();
        let mut object = Buffer::new(object_size);
        unsafe {
            Error::check(BCryptGenerateSymmetricKey(
                self.handle.as_ptr(),
                key_handle.as_mut_ptr(),
                object.as_mut_ptr(),
                object.len() as ULONG,
                secret.as_ptr() as PUCHAR,
                secret.len() as ULONG,
                0,
            ))
            .map(|_| SymmetricAlgorithmKey {
                handle: key_handle,
                _object: object,
            })
        }
    }
/// Creates a new key from the algorithm
///
/// The secret value is the shared-secret between the two parties.
/// For example, it may be a hash of a password or some other reproducible data.
/// The size of the secret must fit with one of the valid key sizes (see [`valid_key_sizes`]).
///
/// [`valid_key_sizes`]: #method.valid_key_sizes
Creates a new key from the algorithm
The secret value is the shared-secret between the two parties.
For example, it may be a hash of a password or some other reproducible data.
The size of the secret must fit with one of the valid key sizes .


Creates a new key from the algorithm The secret value is the shared - secret between the two parties . For example it may be a hash of a password or some other reproducible data . The size of the secret must fit with one of the valid key sizes .
pub fn new_key(&self, secret: &[u8]) -> Result<SymmetricAlgorithmKey> {
        let object_size = self.handle.get_property::<DWORD>(BCRYPT_OBJECT_LENGTH)? as usize;
        let mut key_handle = KeyHandle::new();
        let mut object = Buffer::new(object_size);
        unsafe {
            Error::check(BCryptGenerateSymmetricKey(
                self.handle.as_ptr(),
                key_handle.as_mut_ptr(),
                object.as_mut_ptr(),
                object.len() as ULONG,
                secret.as_ptr() as PUCHAR,
                secret.len() as ULONG,
                0,
            ))
            .map(|_| SymmetricAlgorithmKey {
                handle: key_handle,
                _object: object,
            })
        }
    }
pub fn new_key ( & self , secret : & [ u8 ] ) -> Result < SymmetricAlgorithmKey > { let object_size = self . handle . get_property :: < DWORD > ( BCRYPT_OBJECT_LENGTH ) ? as usize ; let mut key_handle = KeyHandle :: new ( ) ; let mut object = Buffer :: new ( object_size ) ; unsafe { Error :: check ( BCryptGenerateSymmetricKey ( self . handle . as_ptr ( ) , key_handle . as_mut_ptr ( ) , object . as_mut_ptr ( ) , object . len ( ) as ULONG , secret . as_ptr ( ) as PUCHAR , secret . len ( ) as ULONG , 0 , ) ) . map ( | _ | SymmetricAlgorithmKey { handle : key_handle , _object : object , } ) } }
Creates a new key from the algorithm
The secret value is the shared-secret between the two parties.
Creates a new key from the algorithm The secret value is the shared - secret between the two parties .
&self
secret
&[u8]
&self
secret
&[u8]