Struct safe_crypto::PublicId [−][src]
pub struct PublicId { /* fields omitted */ }
Represents a public identity, consisting of a public signature key and a public encryption key.
Methods
impl PublicId
[src]
impl PublicId
pub fn name(&self) -> [u8; 32]
[src]
pub fn name(&self) -> [u8; 32]
Returns a public key representing this public identity.
pub fn encrypt_anonymous<T>(
&self,
plaintext: &T
) -> Result<Vec<u8>, EncryptionError> where
T: Serialize,
[src]
pub fn encrypt_anonymous<T>(
&self,
plaintext: &T
) -> Result<Vec<u8>, EncryptionError> where
T: Serialize,
Encrypts serialisable plaintext
using anonymous encryption.
Anonymous encryption will use an ephemeral public key, so the recipient won't
be able to tell who sent the ciphertext.
If you wish to encrypt bytestring plaintext, use encrypt_anonymous_bytes
.
To use authenticated encryption, use SharedSecretKey
.
Returns ciphertext in case of success.
Can return an EncryptionError
in case of a serialisation error.
pub fn encrypt_anonymous_bytes(&self, plaintext: &[u8]) -> Vec<u8>
[src]
pub fn encrypt_anonymous_bytes(&self, plaintext: &[u8]) -> Vec<u8>
Encrypts bytestring plaintext
using anonymous encryption.
Anonymous encryption will use an ephemeral public key, so the recipient won't
be able to tell who sent the ciphertext.
To use authenticated encryption, use SharedSecretKey
.
Returns ciphertext in case of success.
pub fn verify_detached(&self, signature: &Signature, data: &[u8]) -> bool
[src]
pub fn verify_detached(&self, signature: &Signature, data: &[u8]) -> bool
Verifies the detached signature
.
Returns true
if the signature is valid the data
is verified.
Trait Implementations
impl Debug for PublicId
[src]
impl Debug for PublicId
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Hash for PublicId
[src]
impl Hash for PublicId
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for PublicId
[src]
impl PartialEq for PublicId
fn eq(&self, other: &PublicId) -> bool
[src]
fn eq(&self, other: &PublicId) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &PublicId) -> bool
[src]
fn ne(&self, other: &PublicId) -> bool
This method tests for !=
.
impl Eq for PublicId
[src]
impl Eq for PublicId
impl PartialOrd for PublicId
[src]
impl PartialOrd for PublicId
fn partial_cmp(&self, other: &PublicId) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &PublicId) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &PublicId) -> bool
[src]
fn lt(&self, other: &PublicId) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &PublicId) -> bool
[src]
fn le(&self, other: &PublicId) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &PublicId) -> bool
[src]
fn gt(&self, other: &PublicId) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &PublicId) -> bool
[src]
fn ge(&self, other: &PublicId) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for PublicId
[src]
impl Ord for PublicId
fn cmp(&self, other: &PublicId) -> Ordering
[src]
fn cmp(&self, other: &PublicId) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Clone for PublicId
[src]
impl Clone for PublicId