#[non_exhaustive]
pub enum Mechanism<'a> {
Show 46 variants AesKeyGen, AesCbc([u8; 16]), AesCbcPad([u8; 16]), AesEcb, AesKeyWrap, AesKeyWrapPad, AesGcm(GcmParams<'a>), RsaPkcsKeyPairGen, RsaPkcs, RsaPkcsPss(PkcsPssParams), RsaPkcsOaep(PkcsOaepParams<'a>), RsaX509, DesKeyGen, Des2KeyGen, Des3KeyGen, DesCbc([u8; 8]), Des3Cbc([u8; 8]), DesCbcPad([u8; 8]), Des3CbcPad([u8; 8]), DesEcb, Des3Ecb, EccKeyPairGen, EccEdwardsKeyPairGen, EccMontgomeryKeyPairGen, Ecdh1Derive(Ecdh1DeriveParams<'a>), Ecdsa, EcdsaSha1, EcdsaSha224, EcdsaSha256, EcdsaSha384, EcdsaSha512, Eddsa, Sha1, Sha224, Sha256, Sha384, Sha512, Sha1RsaPkcs, Sha224RsaPkcs, Sha256RsaPkcs, Sha384RsaPkcs, Sha512RsaPkcs, Sha1RsaPkcsPss(PkcsPssParams), Sha256RsaPkcsPss(PkcsPssParams), Sha384RsaPkcsPss(PkcsPssParams), Sha512RsaPkcsPss(PkcsPssParams),
}
Expand description

Type defining a specific mechanism and its parameters

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

AesKeyGen

AES key gen mechanism

§

AesCbc([u8; 16])

AES-CBC mechanism

The parameter to this mechanism is the initialization vector.

For encryption, the message length must be a multiple of the block size. For wrapping, the mechanism encrypts the value of the key, padded on the trailing end with up to block size minus one null bytes. For unwrapping, the result is truncated according to the key type and the length provided by the template.

§

AesCbcPad([u8; 16])

AES-CBC with PKCS#7 padding mechanism

The parameter to this mechanism is the initialization vector.

The plaintext may be any size. The PKCS#7 padding allows the length of the plaintext to be recovered from the ciphertext. Therefore no length should be provided when unwrapping keys with this mechanism.

§

AesEcb

AES in ECB mode

§

AesKeyWrap

AES key wrap

§

AesKeyWrapPad

AES key wrap with padding block

§

AesGcm(GcmParams<'a>)

AES-GCM mechanism

§

RsaPkcsKeyPairGen

PKCS #1 RSA key pair generation mechanism

§

RsaPkcs

Multi-purpose mechanism based on the RSA public-key cryptosystem and the block formats initially defined in PKCS #1 v1.5

§

RsaPkcsPss(PkcsPssParams)

Mechanism based on the RSA public-key cryptosystem and the PSS block format defined in PKCS #1

§

RsaPkcsOaep(PkcsOaepParams<'a>)

Multi-purpose mechanism based on the RSA public-key cryptosystem and the OAEP block format defined in PKCS #1

§

RsaX509

Multi-purpose mechanism based on the RSA public-key cryptosystem. This is so-called “raw” RSA, as assumed in X.509.

§

DesKeyGen

DES

§

Des2KeyGen

DES2

§

Des3KeyGen

DES3

§

DesCbc([u8; 8])

DES-CBC mechanism

The parameter to this mechanism is the initialization vector.

For encryption, the message length must be a multiple of the block size. For wrapping, the mechanism encrypts the value of the key, padded on the trailing end with up to block size minus one null bytes. For unwrapping, the result is truncated according to the key type and the length provided by the template.

§

Des3Cbc([u8; 8])

DES3-CBC mechanism

The parameter to this mechanism is the initialization vector.

For encryption, the message length must be a multiple of the block size. For wrapping, the mechanism encrypts the value of the key, padded on the trailing end with up to block size minus one null bytes. For unwrapping, the result is truncated according to the key type and the length provided by the template.

§

DesCbcPad([u8; 8])

DES-CBC with PKCS#7 padding mechanism

The parameter to this mechanism is the initialization vector.

The plaintext may be any size. The PKCS#7 padding allows the length of the plaintext to be recovered from the ciphertext. Therefore no length should be provided when unwrapping keys with this mechanism.

§

Des3CbcPad([u8; 8])

DES3-CBC with PKCS#7 padding mechanism

The parameter to this mechanism is the initialization vector.

The plaintext may be any size. The PKCS#7 padding allows the length of the plaintext to be recovered from the ciphertext. Therefore no length should be provided when unwrapping keys with this mechanism.

§

DesEcb

DES ECB

§

Des3Ecb

DES3 ECB

§

EccKeyPairGen

EC key pair generation

§

EccEdwardsKeyPairGen

EC edwards key pair generation

§

EccMontgomeryKeyPairGen

EC montgomery key pair generation

§

Ecdh1Derive(Ecdh1DeriveParams<'a>)

ECDH

§

Ecdsa

ECDSA mechanism

§

EcdsaSha1

ECDSA with SHA-1 mechanism

§

EcdsaSha224

ECDSA with SHA-224 mechanism

§

EcdsaSha256

ECDSA with SHA-256 mechanism

§

EcdsaSha384

ECDSA with SHA-384 mechanism

§

EcdsaSha512

ECDSA with SHA-512 mechanism

§

Eddsa

EDDSA mechanism

Note: EdDSA is not part of the PKCS#11 v2.40 standard and as such may not be understood by the backend. It is included here because some vendor implementations support it through the v2.40 interface.

§

Sha1

SHA-1 mechanism

§

Sha224

SHA-224 mechanism

§

Sha256

SHA-256 mechanism

§

Sha384

SHA-384 mechanism

§

Sha512

SHA-512 mechanism

§

Sha1RsaPkcs

SHA1-RSA-PKCS mechanism

§

Sha224RsaPkcs

SHA224-RSA-PKCS mechanism

§

Sha256RsaPkcs

SHA256-RSA-PKCS mechanism

§

Sha384RsaPkcs

SHA384-RSA-PKCS mechanism

§

Sha512RsaPkcs

SHA512-RSA-PKCS mechanism

§

Sha1RsaPkcsPss(PkcsPssParams)

SHA1-RSA-PKCS-PSS mechanism

§

Sha256RsaPkcsPss(PkcsPssParams)

SHA256-RSA-PKCS-PSS mechanism

§

Sha384RsaPkcsPss(PkcsPssParams)

SHA256-RSA-PKCS-PSS mechanism

§

Sha512RsaPkcsPss(PkcsPssParams)

SHA256-RSA-PKCS-PSS mechanism

Implementations§

source§

impl Mechanism<'_>

source

pub fn mechanism_type(&self) -> MechanismType

Get the type of a mechanism

Trait Implementations§

source§

impl<'a> Clone for Mechanism<'a>

source§

fn clone(&self) -> Mechanism<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Mechanism<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&Mechanism<'_>> for CK_MECHANISM

source§

fn from(mech: &Mechanism<'_>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<PkcsOaepParams<'a>> for Mechanism<'a>

source§

fn from(pkcs_oaep_params: PkcsOaepParams<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> Copy for Mechanism<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Mechanism<'a>

§

impl<'a> !Send for Mechanism<'a>

§

impl<'a> !Sync for Mechanism<'a>

§

impl<'a> Unpin for Mechanism<'a>

§

impl<'a> UnwindSafe for Mechanism<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.