pub struct IdCard {
pub auth: DiscoveredKey,
pub sign: DiscoveredKey,
}Expand description
An Estonian ID card.
Fields§
§auth: DiscoveredKeyThe Authentication key (PIN1).
sign: DiscoveredKeyThe Signing key (PIN2).
Implementations§
Source§impl IdCard
impl IdCard
Sourcepub fn find() -> Result<IdCard>
pub fn find() -> Result<IdCard>
Find a specific ID card.
Examples found in repository?
examples/detect_card.rs (line 17)
9fn main() {
10 println!("Scanning for connected Estonian ID cards...\n");
11
12 match resolve_module() {
13 Some(path) => println!("Using PKCS#11 module: {}\n", path.display()),
14 None => println!("Warning: no OpenSC PKCS#11 module found at any known path."),
15 }
16
17 match IdCard::find() {
18 Ok(card) => print_card(&card),
19 Err(EstEidError::NoCard) => {
20 println!(
21 "No Estonian ID card detected.\n Make sure a card is inserted into the reader."
22 );
23 }
24 Err(EstEidError::IncompleteCard(missing)) => {
25 println!("A token was found, but it is missing {missing}.");
26 }
27 Err(EstEidError::MultipleCards(cards)) => {
28 println!("Multiple Estonian ID cards detected; pin one by slot id:");
29 for card in cards {
30 println!(" - {card}");
31 }
32 }
33 Err(EstEidError::Token(source)) => {
34 println!("Failed to talk to the PKCS#11 module: {source}");
35 }
36 }
37}Sourcepub fn document_number(&self) -> &str
pub fn document_number(&self) -> &str
The card’s document number.
Sourcepub fn auth_certificate_der(&self) -> &[u8] ⓘ
pub fn auth_certificate_der(&self) -> &[u8] ⓘ
DER of the Authentication certificate.
Sourcepub fn signing_certificate_der(&self) -> &[u8] ⓘ
pub fn signing_certificate_der(&self) -> &[u8] ⓘ
DER of the Signing certificate.
Sourcepub fn open_auth(&self, pin1: &str) -> Result<TokenKey>
pub fn open_auth(&self, pin1: &str) -> Result<TokenKey>
Open the Authentication key for signing. Requires PIN1.
Sourcepub fn open_signing(&self, pin2: &str) -> Result<TokenKey>
pub fn open_signing(&self, pin2: &str) -> Result<TokenKey>
Open the Signing key for qualified signing. Requires PIN2.
Auto Trait Implementations§
impl Freeze for IdCard
impl RefUnwindSafe for IdCard
impl Send for IdCard
impl Sync for IdCard
impl Unpin for IdCard
impl UnsafeUnpin for IdCard
impl UnwindSafe for IdCard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more