Skip to main content

Card

Trait Card 

Source
pub trait Card {
    // Required methods
    fn info(&mut self) -> Result<CardInfo, CardError>;
    fn verify(&mut self, pin: &Password, mode: PinMode) -> Result<(), CardError>;
    fn sign(&mut self, input: ToSign<'_>) -> Result<Vec<u8>, CardError>;
    fn decipher(
        &mut self,
        input: ToDecipher<'_>,
    ) -> Result<Protected, CardError>;
}
Expand description

A security key, open for one operation: what it says, its PIN, and its two private operations. The opening and the closing are the Readers’.

Required Methods§

Source

fn info(&mut self) -> Result<CardInfo, CardError>

What it says without its PIN.

Source

fn verify(&mut self, pin: &Password, mode: PinMode) -> Result<(), CardError>

Gives it its PIN; a wrong one costs a try.

Source

fn sign(&mut self, input: ToSign<'_>) -> Result<Vec<u8>, CardError>

Signs with its signing key: r ‖ s for EdDSA and ECDSA, s for RSA.

Source

fn decipher(&mut self, input: ToDecipher<'_>) -> Result<Protected, CardError>

Opens with its decryption key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§