Compare commits

...

1 Commits

Author SHA1 Message Date
Bogdan-Ștefan Neacșu 63e1d8fba7 Use correct deserialisation method 2022-02-28 13:22:51 +02:00
3 changed files with 10 additions and 8 deletions
+2 -1
View File
@@ -9,7 +9,8 @@ use tokio::sync::RwLock;
use url::Url;
use coconut_interface::{
self, hash_to_scalar, Attribute, Credential, Parameters, Signature, Theta, VerificationKey,
self, hash_to_scalar, Attribute, Bytable, Credential, Parameters, Signature, Theta,
VerificationKey,
};
use credentials::{obtain_aggregate_signature, obtain_aggregate_verification_key};
+7 -5
View File
@@ -37,11 +37,13 @@ impl Credential {
pub fn verify(&self, verification_key: &VerificationKey) -> bool {
let params = Parameters::new(self.n_params).unwrap();
let public_attributes = self
.public_attributes
.iter()
.map(hash_to_scalar)
.collect::<Vec<Attribute>>();
let mut public_attributes = vec![];
for attr in &self.public_attributes {
match Attribute::try_from_byte_slice(attr) {
Ok(attr) => public_attributes.push(attr),
Err(_) => return false,
}
}
nymcoconut::verify_credential(&params, verification_key, &self.theta, &public_attributes)
}
}
+1 -2
View File
@@ -5,6 +5,7 @@ use std::convert::TryInto;
use bls12_381::Scalar;
pub use crate::traits::Bytable;
pub use elgamal::elgamal_keygen;
pub use elgamal::ElGamalKeyPair;
pub use elgamal::PublicKey;
@@ -28,8 +29,6 @@ pub use scheme::SignatureShare;
pub use traits::Base58;
pub use utils::hash_to_scalar;
use crate::traits::Bytable;
pub mod elgamal;
mod error;
mod impls;