-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,7 +222,7 @@ impl Initiator { | |
.0 | ||
.serialize(); | ||
let rs_pk_xonly = XOnlyPublicKey::from_slice(&rs_pub_key).unwrap(); | ||
if signature_message.verify(&rs_pk_xonly) { | ||
if signature_message.verify(&rs_pk_xonly, &self.pk) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
plebhash
Author
Owner
|
||
let (temp_k1, temp_k2) = Self::hkdf_2(self.get_ck(), &[]); | ||
let c1 = ChaCha20Poly1305::new(&temp_k1.into()); | ||
let c2 = ChaCha20Poly1305::new(&temp_k2.into()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,19 +24,21 @@ impl From<[u8; 74]> for SignatureNoiseMessage { | |
} | ||
|
||
impl SignatureNoiseMessage { | ||
pub fn verify(self, pk: &XOnlyPublicKey) -> bool { | ||
pub fn verify(self, pk: &XOnlyPublicKey, authority_pk: &XOnlyPublicKey) -> bool { | ||
let now = SystemTime::now() | ||
.duration_since(SystemTime::UNIX_EPOCH) | ||
.unwrap() | ||
.as_secs() as u32; | ||
if self.valid_from <= now && self.not_valid_after >= now { | ||
let secp = Secp256k1::verification_only(); | ||
let (m, s) = self.split(); | ||
let m = Message::from_hashed_data::<sha256::Hash>(&m[0..10]); | ||
let m = [&m[0..10], &pk.serialize()].concat(); | ||
This comment has been minimized.
Sorry, something went wrong.
Sjors
|
||
let m = Message::from_hashed_data::<sha256::Hash>(&m); | ||
let s = match Signature::from_slice(&s) { | ||
Ok(s) => s, | ||
_ => return false, | ||
}; | ||
// secp.verify_schnorr(&s, &m, authority_pk).is_ok() | ||
This comment has been minimized.
Sorry, something went wrong. |
||
secp.verify_schnorr(&s, &m, pk).is_ok() | ||
} else { | ||
false | ||
|
Is
self.pk
the expected responder authority key? If so, that's a confusing variable name.