pub enum PrivateKey {
Rsa(RSAPrivateKey),
Secp256k1(SecretKey),
}
Variants§
Rsa(RSAPrivateKey)
Secp256k1(SecretKey)
Implementations§
Source§impl PrivateKey
impl PrivateKey
pub fn key_type(&self) -> PrivateKeyType
pub fn generate_rsa(bits: usize) -> Result<Self, BuckyError>
pub fn generate_rsa_by_rng<R: Rng>( rng: &mut R, bits: usize, ) -> Result<Self, BuckyError>
pub fn generate_secp256k1() -> Result<Self, BuckyError>
pub fn generate_secp256k1_by_rng<R: Rng>( rng: &mut R, ) -> Result<Self, BuckyError>
pub fn generate_by_rng<R: Rng>( rng: &mut R, bits: Option<usize>, pt: PrivateKeyType, ) -> BuckyResult<Self>
pub fn public(&self) -> PublicKey
pub fn sign( &self, data: &[u8], sign_source: SignatureSource, ) -> BuckyResult<Signature>
pub fn decrypt(&self, input: &[u8], output: &mut [u8]) -> BuckyResult<usize>
pub fn decrypt_data(&self, input: &[u8]) -> BuckyResult<Vec<u8>>
pub fn decrypt_aeskey<'d>( &self, input: &'d [u8], output: &mut [u8], ) -> BuckyResult<(&'d [u8], usize)>
pub fn decrypt_aeskey_data<'d>( &self, input: &'d [u8], ) -> BuckyResult<(&'d [u8], Vec<u8>)>
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PrivateKey
impl Debug for PrivateKey
Source§impl Display for PrivateKey
impl Display for PrivateKey
Source§impl PartialEq for PrivateKey
impl PartialEq for PrivateKey
Source§impl<'de> RawDecode<'de> for PrivateKey
impl<'de> RawDecode<'de> for PrivateKey
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 PrivateKey
impl RawEncode for PrivateKey
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>>
impl Eq for PrivateKey
impl StructuralPartialEq for PrivateKey
Auto Trait Implementations§
impl Freeze for PrivateKey
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
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