pub enum PublicKey {
Rsa(RSAPublicKey),
Secp256k1(PublicKey),
Invalid,
}
Variants§
Implementations§
Source§impl PublicKey
impl PublicKey
pub fn key_type_str(&self) -> &str
pub fn key_size(&self) -> usize
pub fn encrypt(&self, data: &[u8], output: &mut [u8]) -> BuckyResult<usize>
pub fn encrypt_data(&self, data: &[u8]) -> BuckyResult<Vec<u8>>
pub fn gen_aeskey_and_encrypt(&self) -> BuckyResult<(AesKey, Vec<u8>)>
pub fn verify(&self, data: &[u8], sign: &Signature) -> bool
Trait Implementations§
Source§impl<'a> From<&'a PublicKey> for PublicKeyRef<'a>
impl<'a> From<&'a PublicKey> for PublicKeyRef<'a>
Source§impl ObjectFormat for PublicKey
impl ObjectFormat for PublicKey
fn format_json(&self) -> Value
Source§impl PublicKeyObj for PublicKey
impl PublicKeyObj for PublicKey
fn from_type_less( single: Option<PublicKey>, mn: Option<MNPublicKey>, ) -> BuckyResult<Self>
fn has_single_key(&self) -> bool
fn has_mn_key(&self) -> bool
Source§impl PublicKeyObjectDesc for PublicKey
impl PublicKeyObjectDesc for PublicKey
fn public_key_ref(&self) -> Option<PublicKeyRef<'_>>
Source§impl<'de> RawDecode<'de> for PublicKey
impl<'de> RawDecode<'de> for PublicKey
fn raw_decode(buf: &'de [u8]) -> Result<(Self, &'de [u8]), BuckyError>
fn raw_decode_with_option( buf: &'de [u8], _opt: &RawDecodeOption, ) -> BuckyResult<(Self, &'de [u8])>
Source§impl RawEncode for PublicKey
impl RawEncode for PublicKey
fn raw_measure( &self, _purpose: &Option<RawEncodePurpose>, ) -> Result<usize, BuckyError>
fn raw_encode<'a>( &self, buf: &'a mut [u8], _purpose: &Option<RawEncodePurpose>, ) -> Result<&'a mut [u8], BuckyError>
fn raw_tail_encode<'a>( &self, buf: &'a mut [u8], purpose: &Option<RawEncodePurpose>, ) -> BuckyResult<&'a [u8]>
fn raw_encode_to_buffer(&self) -> BuckyResult<Vec<u8>>
fn raw_hash_value(&self) -> BuckyResult<HashValue>
fn hash_buf(&self, encoded_buf: &[u8]) -> HashValue
fn raw_hash_encode(&self) -> BuckyResult<Vec<u8>>
Source§impl RawFixedBytes for PublicKey
impl RawFixedBytes for PublicKey
Source§impl SingleKeyObjectDesc for PublicKey
impl SingleKeyObjectDesc for PublicKey
fn public_key(&self) -> &PublicKey
Source§impl SubDescType for PublicKey
§PublicKey
用于SingleKeyObjectDesc
impl SubDescType for PublicKey
§PublicKey
用于SingleKeyObjectDesc
fn is_none(&self) -> bool
fn inner_raw_measure( &self, purpose: &Option<RawEncodePurpose>, ) -> Result<usize, BuckyError>
fn inner_raw_encode<'a>( &self, buf: &'a mut [u8], purpose: &Option<RawEncodePurpose>, ) -> Result<&'a mut [u8], BuckyError>
fn inner_raw_decode<'de>( buf: &'de [u8], ) -> Result<(Self, &'de [u8]), BuckyError>
fn is_support() -> bool
fn is_some(&self) -> bool
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, D> FileDecoder<'de> for Dwhere
D: RawDecode<'de>,
impl<'de, D> FileDecoder<'de> for Dwhere
D: RawDecode<'de>,
fn decode_from_file( file: &Path, buf: &'de mut Vec<u8>, ) -> Result<(D, usize), BuckyError>
Source§impl<D> FileEncoder<D> for Dwhere
D: RawEncode,
impl<D> FileEncoder<D> for Dwhere
D: RawEncode,
fn suggest_buffer_size(&self) -> Result<usize, BuckyError>
fn encode<'a>( &self, buf: &'a mut [u8], _is_compress: bool, ) -> Result<&'a mut [u8], BuckyError>
fn encode_to_writer( &self, writer: impl Write, is_compress: bool, ) -> BuckyResult<usize>
fn encode_to_file(&self, file: &Path, is_compress: bool) -> BuckyResult<usize>
fn encode_to_vec(&self, is_compress: bool) -> BuckyResult<Vec<u8>>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more