[−][src]Enum kerbeiros::key::Key
Encapsules the possible keys used by this Kerberos implementation. Each key can be used by a different cryptographic algorithm.
Variants
Password(String)
The password of the user, it is the most versatile key, since can it can be use for obtain the rest of the keys, and therefore, being used by any cryptographic algotithm.
RC4 key used by RC4-HMAC algorithm. In Windows is the NTLM hash of the user password.
AES key used by AES128-CTS-HMAC-SHA1-96 algorithm.
AES key used by AES256-CTS-HMAC-SHA1-96 algorithm.
Methods
impl Key
[src]
pub fn etype(&self) -> i32
[src]
Return the etype associated with the type of key.
Examples
use kerbeiros::key; use kerberos_constants::etypes::*; assert_eq!(0, key::Key::Password("".to_string()).etype()); assert_eq!(RC4_HMAC, key::Key::RC4Key([0; key::RC4_KEY_SIZE]).etype()); assert_eq!(AES128_CTS_HMAC_SHA1_96, key::Key::AES128Key([0; key::AES128_KEY_SIZE]).etype()); assert_eq!(AES256_CTS_HMAC_SHA1_96, key::Key::AES256Key([0; key::AES256_KEY_SIZE]).etype());
pub fn as_bytes(&self) -> &[u8]
[src]
Retrieve the key as an array of bytes.
Examples
use kerbeiros::key; assert_eq!(&[0x73, 0x65, 0x63, 0x72, 0x65, 0x74], key::Key::Password("secret".to_string()).as_bytes()); assert_eq!(&[0; key::RC4_KEY_SIZE], key::Key::RC4Key([0; key::RC4_KEY_SIZE]).as_bytes()); assert_eq!(&[0; key::AES128_KEY_SIZE], key::Key::AES128Key([0; key::AES128_KEY_SIZE]).as_bytes()); assert_eq!(&[0; key::AES256_KEY_SIZE], key::Key::AES256Key([0; key::AES256_KEY_SIZE]).as_bytes());
pub fn from_rc4_key_string(hex_str: &str) -> Result<Self>
[src]
Get a RC4 key from a hexdump.
Example
use kerbeiros::Key; assert_eq!( Key::RC4Key([0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]), Key::from_rc4_key_string("0123456789ABCDEF0123456789abcdef").unwrap() );
Errors
An error if raised if the argument string has any non hexadecimal character or size is different from 32.
pub fn from_aes_128_key_string(hex_str: &str) -> Result<Self>
[src]
Get a AES-128 key from a hexdump.
Example
use kerbeiros::Key; assert_eq!( Key::AES128Key([0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef]), Key::from_aes_128_key_string("0123456789ABCDEF0123456789abcdef").unwrap() );
Errors
An error if raised if the argument string has any non hexadecimal character or size is different from 32.
pub fn from_aes_256_key_string(hex_str: &str) -> Result<Self>
[src]
Get a AES-256 key from a hexdump.
Example
use kerbeiros::Key; assert_eq!( Key::AES256Key([ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef ]), Key::from_aes_256_key_string("0123456789ABCDEF0123456789abcdef0123456789ABCDEF0123456789abcdef").unwrap() );
Errors
An error if raised if the argument string has any non hexadecimal character or size is different from 64.
Trait Implementations
impl Clone for Key
[src]
impl Debug for Key
[src]
impl PartialEq<Key> for Key
[src]
impl StructuralPartialEq for Key
[src]
Auto Trait Implementations
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,