Struct ssb_common::keys::PublicKey
[−]
[src]
pub struct PublicKey(_);
An ssb public key. This type abstracts over the fact that ssb can support multiple cryptographic primitives.
Methods
impl PublicKey
[src]
fn len(&self) -> usize
[src]
Return the length (in bytes) of the key.
fn verify(&self, signed_message: &[u8]) -> Result<Vec<u8>, ()>
[src]
Verify the given signed message with this PublicKey
. On success,
return a Vec<u8>
containing the message without the signature.
fn verify_detached(&self, signature: &Signature, signed_message: &[u8]) -> bool
[src]
Verify the given message with this PublicKey
and the given Signature
.
Panics
Panics if this PublicKey
and the Signature
use different
cryptographic primitives.
fn try_verify_detached(
&self,
signature: &Signature,
signed_message: &[u8]
) -> Option<bool>
[src]
&self,
signature: &Signature,
signed_message: &[u8]
) -> Option<bool>
Verify the given message with this PublicKey
and the given Signature
.
Return None
if this PublicKey
and the Signature
use different
cryptographic primitives.
fn is_ed25519(&self) -> bool
[src]
Return whether this PublicKey
uses the ed25519 cryptographic primitive.
fn is_considered_secure(&self) -> bool
[src]
Return whether this PublicKey
uses a cryptographic primitive that is
currently considered secure.
The return value of this method may change as new versions of this module are released.
fn matches_secret_key(&self, secret_key: &SecretKey) -> bool
[src]
Return whether this PublicKey
uses the same cryptographic primitive as
the given SecretKey
.
fn matches_signature(&self, signature: &Signature) -> bool
[src]
Return whether this PublicKey
uses the same cryptographic primitive as
the given Signature
.
fn from_encoding(enc: &PublicKeyEnc) -> PublicKey
[src]
Create a PublicKey
from a PublicKeyEnc
.
Prefer to directly use the FromStr
impl.
Trait Implementations
impl Copy for PublicKey
[src]
impl Clone for PublicKey
[src]
fn clone(&self) -> PublicKey
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for PublicKey
[src]
fn eq(&self, __arg_0: &PublicKey) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &PublicKey) -> bool
[src]
This method tests for !=
.
impl Eq for PublicKey
[src]
impl PartialOrd for PublicKey
[src]
fn partial_cmp(&self, __arg_0: &PublicKey) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &PublicKey) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &PublicKey) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &PublicKey) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &PublicKey) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for PublicKey
[src]
fn cmp(&self, __arg_0: &PublicKey) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl Hash for PublicKey
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
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]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for PublicKey
[src]
impl From<PublicKey> for PublicKey
[src]
impl TryInto<PublicKey> for PublicKey
[src]
type Error = ()
try_from
)Fails if the underlying cryptographic primitive is not ed25519.
fn try_into(self) -> Result<PublicKey, Self::Error>
[src]
try_from
)Performs the conversion.
impl AsRef<[u8]> for PublicKey
[src]
impl Index<Range<usize>> for PublicKey
[src]
Allows to access the byte contents of a PublicKey
as a slice.
type Output = [u8]
The returned type after indexing.
fn index(&self, _index: Range<usize>) -> &[u8]
[src]
Performs the indexing (container[index]
) operation.
impl Index<RangeTo<usize>> for PublicKey
[src]
Allows to access the byte contents of a PublicKey
as a slice.
type Output = [u8]
The returned type after indexing.
fn index(&self, _index: RangeTo<usize>) -> &[u8]
[src]
Performs the indexing (container[index]
) operation.
impl Index<RangeFrom<usize>> for PublicKey
[src]
Allows to access the byte contents of a PublicKey
as a slice.
type Output = [u8]
The returned type after indexing.
fn index(&self, _index: RangeFrom<usize>) -> &[u8]
[src]
Performs the indexing (container[index]
) operation.
impl Index<RangeFull> for PublicKey
[src]
Allows to access the byte contents of a PublicKey
as a slice.
type Output = [u8]
The returned type after indexing.
fn index(&self, _index: RangeFull) -> &[u8]
[src]
Performs the indexing (container[index]
) operation.
impl From<PublicKeyEncBuf> for PublicKey
[src]
fn from(enc: PublicKeyEncBuf) -> PublicKey
[src]
Performs the conversion.
impl FromStr for PublicKey
[src]
This can be used to parse an encoded PublicKey
.