AttributeType

Enum AttributeType 

Source
#[non_exhaustive]
pub enum AttributeType {
Show 78 variants AcIssuer, AllowedMechanisms, AlwaysAuthenticate, AlwaysSensitive, Application, AttrTypes, Base, CertificateType, CheckValue, Class, Coefficient, Copyable, Decapsulate, Decrypt, Derive, Destroyable, EcParams, EcPoint, Encapsulate, Encrypt, EndDate, Exponent1, Exponent2, Extractable, HashOfIssuerPublicKey, HashOfSubjectPublicKey, Id, Issuer, KeyGenMechanism, KeyType, Label, Local, Modifiable, Modulus, ModulusBits, NeverExtractable, ObjectId, ObjectValidationFlags, Owner, ParameterSet, Prime, Prime1, Prime2, Private, PrivateExponent, PublicExponent, PublicKeyInfo, ProfileId, Seed, Sensitive, SerialNumber, Sign, SignRecover, StartDate, Subject, Token, Trusted, UniqueId, Unwrap, Url, ValidationType, ValidationVersion, ValidationLevel, ValidationModuleId, ValidationFlag, ValidationAuthorityType, ValidationCountry, ValidationCertificateIdentifier, ValidationCertificateUri, ValidationVendorUri, ValidationProfile, Value, ValueLen, VendorDefined(CK_ATTRIBUTE_TYPE), Verify, VerifyRecover, Wrap, WrapWithTrusted,
}
Expand description

Type of an attribute

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.
§

AcIssuer

DER-encoding of the attribute certificate’s issuer

§

AllowedMechanisms

List of mechanisms allowed to be used with the key

§

AlwaysAuthenticate

Indicates that the user has to supply the PIN for each use with the key

§

AlwaysSensitive

Indicates if the key has always had the Sensitive attribute set to true

§

Application

Description of the application that manages the object

§

AttrTypes

BER-encoding of a sequence of object identifier values

§

Base

Base number value of a key

§

CertificateType

Type of certificate

§

CheckValue

Checksum

§

Class

Type of an object

§

Coefficient

The CRT coefficient iqmp of an RSA private key

§

Copyable

Determines if an object can be copied

§

Decapsulate

Determines if a key supports key decapsulation

§

Decrypt

Determines if a key supports decryption

§

Derive

Determines if it is possible to derive other keys from the key

§

Destroyable

Determines if it is possible to destroy an object

§

EcParams

Parameters defining an elliptic curve

§

EcPoint

DER-encoded Elliptic Curve point

§

Encapsulate

Determines if a key supports key encapsulation

§

Encrypt

Determines if a key supports encryption

§

EndDate

The end date for the object

§

Exponent1

The private exponent dmp1 of an RSA private key

§

Exponent2

The private exponent dmq1 of an RSA private key

§

Extractable

Determines if a key is extractable and can be wrapped

§

HashOfIssuerPublicKey

Hash of issuer public key

§

HashOfSubjectPublicKey

Hash of subject public key

§

Id

Key identifier for key

§

Issuer

DER-encoding of the certificate issuer name

§

KeyGenMechanism

Identifier of the mechanism used to generate the key material

§

KeyType

Type of a key

§

Label

Description of the object

§

Local

Indicates if the key was generated locally or copied from a locally created object

§

Modifiable

Determines if the object can be modified

§

Modulus

Modulus value of a key

§

ModulusBits

Length in bits of the modulus of a key

§

NeverExtractable

Indicates if the key has never had the Extractable attribute set to true

§

ObjectId

Object ID

§

ObjectValidationFlags

Object Validation flags

§

Owner

DER encoding of the attribute certificate’s subject field

§

ParameterSet

Algorithm-specific parameter set

§

Prime

Prime number value of a key

§

Prime1

The prime p of an RSA private key

§

Prime2

The prime q of an RSA private key

§

Private

Determines if the object is private

§

PrivateExponent

Private exponent d

§

PublicExponent

Public exponent value of a key

§

PublicKeyInfo

DER-encoding of the SubjectPublicKeyInfo

§

ProfileId

Profile ID

§

Seed

Seed to derive private key

§

Sensitive

Determines if the key is sensitive

§

SerialNumber

DER encoding of the certificate serial number

§

Sign

Determines if a key supports signing

§

SignRecover

Determines if a key supports signing where the data can be recovered from the signature

§

StartDate

The start date of the object

§

Subject

DER-encoding of certificate subject name

§

Token

Determines if the object is a token object

§

Trusted

Determines if the object is trusted

§

UniqueId

Unique Object Id

§

Unwrap

Determines if a key supports unwrapping

§

Url

Gives the URL where the complete certificate can be obtained

§

ValidationType

Identifier indicating the validation type

§

ValidationVersion

Version of the validation standard or specification

§

ValidationLevel

Validation level, Meaning is Validation type specific

§

ValidationModuleId

How the module is identified in the validation documentation

§

ValidationFlag

Flags identifying this validation in sessions and objects

§

ValidationAuthorityType

Identifies the authority that issues the validation

§

ValidationCountry

2 letter ISO country code

§

ValidationCertificateIdentifier

Identifier of the validation certificate

§

ValidationCertificateUri

Validation authority URI from which information related to the validation is available. If the Validation Certificate URI is not provided, the validation object SHOULD include a Validation Vendor URI.

§

ValidationVendorUri

Validation Vendor URI from which information related to the validation is available.

§

ValidationProfile

Profile used for validation

§

Value

Value of the object

§

ValueLen

Length in bytes of the value

§

VendorDefined(CK_ATTRIBUTE_TYPE)

Vendor defined attribute

§

Verify

Determines if a key supports verifying

§

VerifyRecover

Determines if a key supports verifying where the data can be recovered from the signature

§

Wrap

Determines if a key supports wrapping

§

WrapWithTrusted

Indicates that the key can only be wrapped with a wrapping key that has the Trusted attribute

Implementations§

Source§

impl AttributeType

Source

pub fn fixed_size(&self) -> Option<usize>

Returns the fixed size of an attribute type if known.

This method returns Some(size) for attributes with a known fixed size, and None for variable-length attributes. This is useful for optimizing attribute retrieval by pre-allocating buffers of the correct size.

§Returns
  • Some(usize) - The fixed size in bytes for attributes with known fixed size
  • None - For variable-length attributes (e.g., Label, Modulus, Value, etc.)
§Examples
use cryptoki::object::AttributeType;
use std::mem::size_of;
use cryptoki_sys::{CK_ULONG, CK_BBOOL};

// Fixed-size attributes
assert_eq!(AttributeType::Class.fixed_size(), Some(size_of::<CK_ULONG>()));
assert_eq!(AttributeType::Token.fixed_size(), Some(size_of::<CK_BBOOL>()));

// Variable-length attributes
assert_eq!(AttributeType::Label.fixed_size(), None);
assert_eq!(AttributeType::Modulus.fixed_size(), None);

Trait Implementations§

Source§

impl Clone for AttributeType

Source§

fn clone(&self) -> AttributeType

Returns a duplicate 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 Debug for AttributeType

Source§

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

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

impl Display for AttributeType

Source§

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

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

impl From<AttributeType> for CK_ATTRIBUTE_TYPE

Source§

fn from(attribute_type: AttributeType) -> Self

Converts to this type from the input type.
Source§

impl Hash for AttributeType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for AttributeType

Source§

fn cmp(&self, other: &AttributeType) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for AttributeType

Source§

fn eq(&self, other: &AttributeType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for AttributeType

Source§

fn partial_cmp(&self, other: &AttributeType) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TryFrom<u64> for AttributeType

Source§

type Error = Error

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

fn try_from(attribute_type: CK_ATTRIBUTE_TYPE) -> Result<Self>

Performs the conversion.
Source§

impl Copy for AttributeType

Source§

impl Eq for AttributeType

Source§

impl StructuralPartialEq for AttributeType

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.