Enum cyfs_base::PrivateKey
source · pub enum PrivateKey {
Rsa(RSAPrivateKey),
Secp256k1(SecretKey),
}
Variants
Rsa(RSAPrivateKey)
Secp256k1(SecretKey)
Implementations
sourceimpl 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
sourceimpl Clone for PrivateKey
impl Clone for PrivateKey
sourcefn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for PrivateKey
impl Debug for PrivateKey
sourceimpl Display for PrivateKey
impl Display for PrivateKey
sourceimpl PartialEq<PrivateKey> for PrivateKey
impl PartialEq<PrivateKey> for PrivateKey
sourcefn eq(&self, other: &PrivateKey) -> bool
fn eq(&self, other: &PrivateKey) -> bool
sourceimpl<'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])>
sourceimpl 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 StructuralEq for PrivateKey
impl StructuralPartialEq for PrivateKey
Auto Trait Implementations
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more