[][src]Enum psa_crypto::types::key::Type

pub enum Type {
    RawData,
    Hmac,
    Derive,
    Aes,
    Des,
    Camellia,
    Arc4,
    Chacha20,
    RsaPublicKey,
    RsaKeyPair,
    EccKeyPair {
        curve_family: EccFamily,
    },
    EccPublicKey {
        curve_family: EccFamily,
    },
    DhKeyPair {
        group_family: DhFamily,
    },
    DhPublicKey {
        group_family: DhFamily,
    },
}

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

Elliptic curve key pair: both the private and public key.

Fields of EccKeyPair

curve_family: EccFamily

ECC curve family to use.

EccPublicKey

Elliptic curve public key.

Fields of EccPublicKey

curve_family: EccFamily

ECC curve family to use.

DhKeyPair

Diffie-Hellman key pair: both the private key and public key.

Fields of DhKeyPair

group_family: DhFamily

Diffie-Hellman group family to use.

DhPublicKey

Diffie-Hellman public key.

Fields of DhPublicKey

group_family: DhFamily

Diffie-Hellman group family to use.

Implementations

impl Type[src]

pub fn is_ecc_key_pair(self) -> bool[src]

Checks if a key type is ECC key pair with any curve family inside.

pub fn is_ecc_public_key(self) -> bool[src]

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());

pub fn is_dh_public_key(self) -> bool[src]

Checks if a key type is DH public key with any group family inside.

pub fn is_dh_key_pair(self) -> bool[src]

Checks if a key type is DH key pair with any group family inside.

pub fn key_type_public_key_of_key_pair(self) -> Result<Type>[src]

If key is public or key pair, returns the corresponding public key type.

Trait Implementations

impl Clone for Type[src]

impl Copy for Type[src]

impl Debug for Type[src]

impl<'de> Deserialize<'de> for Type[src]

impl PartialEq<Type> for Type[src]

impl Serialize for Type[src]

impl StructuralPartialEq for Type[src]

impl TryFrom<u16> for Type[src]

type Error = Error

The type returned in the event of a conversion error.

impl Zeroize for Type[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.