Enum cyfs_base::PrivateKey
source · 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 copy 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<PrivateKey> for PrivateKey
impl PartialEq<PrivateKey> for PrivateKey
source§fn eq(&self, other: &PrivateKey) -> bool
fn eq(&self, other: &PrivateKey) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.