pub enum Type {
}Expand description
Enumeration of key types supported.
Variants
RawData
Not a valid key type for any cryptographic operation but can be used to store arbitrary data in the key store.
Hmac
HMAC key.
Derive
A secret key for derivation.
Aes
Key for a cipher, AEAD or MAC algorithm based on the AES block cipher.
Des
Key for a cipher or MAC algorithm based on DES or 3DES (Triple-DES).
Camellia
Key for a cipher, AEAD or MAC algorithm based on the Camellia block cipher.
Arc4
Key for the RC4 stream cipher.
Chacha20
Key for the ChaCha20 stream cipher or the Chacha20-Poly1305 AEAD algorithm.
RsaPublicKey
RSA public key.
RsaKeyPair
RSA key pair: both the private and public key.
EccKeyPair
Fields
curve_family: EccFamilyECC curve family to use.
Elliptic curve key pair: both the private and public key.
EccPublicKey
Fields
curve_family: EccFamilyECC curve family to use.
Elliptic curve public key.
DhKeyPair
Fields
group_family: DhFamilyDiffie-Hellman group family to use.
Diffie-Hellman key pair: both the private key and public key.
DhPublicKey
Fields
group_family: DhFamilyDiffie-Hellman group family to use.
Diffie-Hellman public key.
Implementations
sourceimpl Type
impl Type
sourcepub fn is_ecc_key_pair(self) -> bool
pub fn is_ecc_key_pair(self) -> bool
Checks if a key type is ECC key pair with any curve family inside.
sourcepub fn is_ecc_public_key(self) -> bool
pub fn is_ecc_public_key(self) -> bool
Checks if a key type is ECC public key with any curve family inside.
Example
use psa_crypto::types::key::{Type, EccFamily};
assert!(Type::EccPublicKey { curve_family: EccFamily::SecpK1}.is_ecc_public_key());sourcepub fn is_rsa_public_key(self) -> bool
pub fn is_rsa_public_key(self) -> bool
Checks if a key type is RSA public key.
sourcepub fn is_dh_public_key(self) -> bool
pub fn is_dh_public_key(self) -> bool
Checks if a key type is DH public key with any group family inside.
sourcepub fn is_dh_key_pair(self) -> bool
pub fn is_dh_key_pair(self) -> bool
Checks if a key type is DH key pair with any group family inside.
sourcepub fn is_public_key(self) -> bool
pub fn is_public_key(self) -> bool
Checks if a key type is an asymmetric public key type.
sourcepub fn key_type_public_key_of_key_pair(self) -> Result<Type>
pub fn key_type_public_key_of_key_pair(self) -> Result<Type>
If key is public or key pair, returns the corresponding public key type.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<Type> for Type
impl PartialEq<Type> for Type
sourceimpl TryFrom<Type> for psa_key_type_t
impl TryFrom<Type> for psa_key_type_t
impl Copy for Type
impl Eq for Type
impl StructuralEq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more