Struct cryptoballot::Authenticator [−][src]
pub struct Authenticator { pub id: Uuid, pub public_keys: IndexMap<String, AuthPublicKey>, }
Expand description
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:
- Voter’s bonefides (government-id, security-code, password etc).
- Election ID and Ballot ID
- 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: Uuid
public_keys: IndexMap<String, AuthPublicKey>
Implementations
impl Authenticator
[src]
impl Authenticator
[src]pub fn new(
keysize: usize,
ballot_ids: &[String]
) -> Result<(Self, IndexMap<String, RSAPrivateKey>), Error>
[src]
pub fn new(
keysize: usize,
ballot_ids: &[String]
) -> Result<(Self, IndexMap<String, 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]
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.
Trait Implementations
impl Clone for Authenticator
[src]
impl Clone for Authenticator
[src]fn clone(&self) -> Authenticator
[src]
fn clone(&self) -> Authenticator
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for Authenticator
[src]
impl Debug for Authenticator
[src]impl<'de> Deserialize<'de> for Authenticator
[src]
impl<'de> Deserialize<'de> for Authenticator
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl Serialize for Authenticator
[src]
impl Serialize for Authenticator
[src]Auto Trait Implementations
impl RefUnwindSafe for Authenticator
impl Send for Authenticator
impl Sync for Authenticator
impl Unpin for Authenticator
impl UnwindSafe for Authenticator
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
[src]
impl<T> Pointable for T
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,