Skip to content
Permalink
Browse files

add accessor to period and update

  • Loading branch information...
vincenthz committed May 14, 2019
1 parent 25baf22 commit 5f22b92596b988baeb691c8adb252d3b0e0eca08
Showing with 17 additions and 1 deletion.
  1. +8 −1 chain-crypto/src/algorithms/fakemmm.rs
  2. +9 −0 chain-crypto/src/kes.rs
@@ -97,7 +97,14 @@ impl VerificationAlgorithm for FakeMMM {
}

impl KeyEvolvingSignatureAlgorithm for FakeMMM {
fn sign_update(key: &mut Self::Secret, msg: &[u8]) -> Sig {
fn get_period(_: &Self::Signature) -> usize {
0
}
fn update(_: &mut Self::Secret) -> bool {
false
}

fn sign_update(key: &mut Self::Secret, msg: &[u8]) -> Self::Signature {
let (sk, _) = ed25519::keypair(&key.0);
Sig(ed25519::signature(msg, &sk))
}
@@ -1,5 +1,14 @@
use crate::sign::VerificationAlgorithm;

pub trait KeyEvolvingSignatureAlgorithm: VerificationAlgorithm {
/// Get the period associated with this signature
fn get_period(key: &Self::Signature) -> usize;

/// Update the key to the next period
///
/// if false is returned, then the key couldn't be updated
fn update(key: &mut Self::Secret) -> bool;

/// Sign with the current secret key and update to the next period
fn sign_update(key: &mut Self::Secret, msg: &[u8]) -> Self::Signature;
}

0 comments on commit 5f22b92

Please sign in to comment.
You can’t perform that action at this time.