Skip to main content
Sign in
Snippets Groups Projects
Commit 85db4b77 authored by Éloïs's avatar Éloïs
Browse files

[ref] crypto: remove professional notions

parent 918a5086
Branches
Tags
1 merge request!164Elois/currency params
...@@ -22,19 +22,19 @@ use serde::{Deserialize, Serialize}; ...@@ -22,19 +22,19 @@ use serde::{Deserialize, Serialize};
/// Signatureable in binary format /// Signatureable in binary format
pub trait BinSignable<'de>: Serialize + Deserialize<'de> { pub trait BinSignable<'de>: Serialize + Deserialize<'de> {
/// Return message issuer pubkey /// Return entity issuer pubkey
fn issuer_pubkey(&self) -> PubKey; fn issuer_pubkey(&self) -> PubKey;
/// Return true if message store is hash /// Return true if entity store is hash
fn store_hash(&self) -> bool { fn store_hash(&self) -> bool {
false false
} }
/// Return message hash /// Return entity hash
fn hash(&self) -> Option<Hash> { fn hash(&self) -> Option<Hash> {
None None
} }
/// Change hash (redefinely by messages with hash field) /// Change hash (redefinely by entities with hash field)
fn set_hash(&mut self, _hash: Hash) {} fn set_hash(&mut self, _hash: Hash) {}
/// Return message signature /// Return signature
fn signature(&self) -> Option<Sig>; fn signature(&self) -> Option<Sig>;
/// Change signature /// Change signature
fn set_signature(&mut self, _signature: Sig); fn set_signature(&mut self, _signature: Sig);
...@@ -57,7 +57,7 @@ pub trait BinSignable<'de>: Serialize + Deserialize<'de> { ...@@ -57,7 +57,7 @@ pub trait BinSignable<'de>: Serialize + Deserialize<'de> {
let hash = Hash::compute(&bin_msg); let hash = Hash::compute(&bin_msg);
Ok((hash, bin_msg)) Ok((hash, bin_msg))
} }
/// Sign bin message /// Sign entity with a private key
fn sign(&mut self, priv_key: PrivKey) -> Result<Vec<u8>, SignError> { fn sign(&mut self, priv_key: PrivKey) -> Result<Vec<u8>, SignError> {
if self.signature().is_some() { if self.signature().is_some() {
return Err(SignError::AlreadySign()); return Err(SignError::AlreadySign());
...@@ -92,7 +92,7 @@ pub trait BinSignable<'de>: Serialize + Deserialize<'de> { ...@@ -92,7 +92,7 @@ pub trait BinSignable<'de>: Serialize + Deserialize<'de> {
_ => Err(SignError::WrongAlgo()), _ => Err(SignError::WrongAlgo()),
} }
} }
/// Check signature of bin message /// Check signature of entity
fn verify(&self) -> Result<(), SigError> { fn verify(&self) -> Result<(), SigError> {
if let Some(signature) = self.signature() { if let Some(signature) = self.signature() {
match self.issuer_pubkey() { match self.issuer_pubkey() {
... ...
......
// Copyright (C) 2018 The Duniter Project Developers. // Copyright (C) 2018 The Durs Project Developers.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
... ...
......
...@@ -21,13 +21,13 @@ use super::*; ...@@ -21,13 +21,13 @@ use super::*;
pub trait TextSignable: Debug + Clone { pub trait TextSignable: Debug + Clone {
/// Return signable text /// Return signable text
fn as_signable_text(&self) -> String; fn as_signable_text(&self) -> String;
/// Return message issuer pubkey /// Return entity issuer pubkey
fn issuer_pubkey(&self) -> PubKey; fn issuer_pubkey(&self) -> PubKey;
/// Return message signature /// Return entity signature
fn signature(&self) -> Option<Sig>; fn signature(&self) -> Option<Sig>;
/// Change signature /// Change signature
fn set_signature(&mut self, _signature: Sig); fn set_signature(&mut self, _signature: Sig);
/// Sign text message /// Sign entity
fn sign(&mut self, priv_key: PrivKey) -> Result<String, SignError> { fn sign(&mut self, priv_key: PrivKey) -> Result<String, SignError> {
if self.signature().is_some() { if self.signature().is_some() {
return Err(SignError::AlreadySign()); return Err(SignError::AlreadySign());
...@@ -46,7 +46,7 @@ pub trait TextSignable: Debug + Clone { ...@@ -46,7 +46,7 @@ pub trait TextSignable: Debug + Clone {
_ => Err(SignError::WrongAlgo()), _ => Err(SignError::WrongAlgo()),
} }
} }
/// Check signature of text message /// Check signature of entity
fn verify(&self) -> Result<(), SigError> { fn verify(&self) -> Result<(), SigError> {
if let Some(signature) = self.signature() { if let Some(signature) = self.signature() {
match self.issuer_pubkey() { match self.issuer_pubkey() {
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment