Resolve "Create PublicKey, PrivateKey and Keypair enum"
1 unresolved thread
1 unresolved thread
Closes #77 (closed)
Edited by Éloïs
Merge request reports
Activity
Filter activity
added 1 commit
- 52afc05f - [ref] #77 (closed) create PubKey,PrivKey & KeyPair Enums
mentioned in commit 03b6bc9e
211 serializer.serialize_str(&format!("{}", self)) 212 } 213 } 214 215 impl PublicKey for PubKey { 216 type Signature = Sig; 217 218 fn from_base58(_base58_string: &str) -> Result<Self, BaseConvertionError> { 219 unimplemented!() 220 } 221 fn verify(&self, message: &[u8], signature: &Self::Signature) -> bool { 222 match *self { 223 PubKey::Ed25519(ed25519_pubkey) => if let Sig::Ed25519(ed25519_sig) = signature { 224 ed25519_pubkey.verify(message, ed25519_sig) 225 } else { 226 panic!("Try to verify a signature with public key of a different algorithm !\nSignature={:?}\nPublickey={:?}", signature, self) It should not panic, only return false. @librelois
Edited by nanocrykSo each time a document with a "variable keytype" contains a signature incompatible with the public key is checked, it will panic ?
There should be unit tests to verify future implementations of algorithms, but I think this kind of behavior should not be present in running nodes. If signature is not of good type, it's still an invalid signature.
changed milestone to %v0.3 Minimal mirror node
Please register or sign in to reply