[][src]Struct cryptoballot::Authenticator

pub struct Authenticator {
    pub id: Uuid,
    pub public_keys: BTreeMap<Uuid, AuthPublicKey>,
}

An Authenticator is responsible for authenticating a voter as allowed to vote a specific ballot in an election.

An authenticator receives the following from a voter:

  1. Voter's bonefides (government-id, security-code, password etc).
  2. Election ID and Ballot ID
  3. blinded auth-package triplet of (election-id, ballot-id, voter-public-key)

The authenticator first checks the election-id and ballot-id against the voter's bonefides (this is implementation specific and out of scope of CryptoBallot). After satisfied that the voter is allowed to vote this election and ballot, the authenticator blind-signs the blinded triplet and returns the signature to the voter who will unblind it.

Before the election, the authenticator will generate a signing keypair for each ballot-id. Having on key per ballot ensures that the blinded triplet matches the correct election and ballot.

WARNING: The secret keys used to sign blinded triplets must NOT be used for any other purpose. Doing so can result in secret key disclosure.

Fields

id: Uuidpublic_keys: BTreeMap<Uuid, AuthPublicKey>

Methods

impl Authenticator[src]

pub fn new(
    keysize: usize,
    ballot_ids: &[Uuid]
) -> Result<(Self, HashMap<Uuid, RSAPrivateKey>), Error>
[src]

Create a new Authenticator, generating keys for provided ballot-ids.

For good security, keysize should be at least 2048 bits, and ideally 4096 bits.

WARNING: The secret keys generated here must NOT be used for any other purpose. Doing so can result in secret key disclosure.

pub fn authenticate(
    &self,
    secret: &RSAPrivateKey,
    blinded_auth_package: &[u8]
) -> Authentication
[src]

Sign the blinded (election-id, ballot-id, voter-public-key) auth-package triplet.

This should only be called after verifying the voter's bonefides (eg government-id, security-code, password etc) and that they are authorized to vote the requested election and ballot.

pub fn verify(
    &self,
    election_id: Identifier,
    ballot_id: Uuid,
    anonymous_key: &PublicKey,
    signature: &[u8]
) -> Result<(), ValidationError>
[src]

Verify the authenticator signature

Trait Implementations

impl Clone for Authenticator[src]

impl Debug for Authenticator[src]

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

impl Serialize for Authenticator[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: Deserialize<'de>, 
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,