pub struct PrivateKey(/* private fields */);Expand description
A private key that can sign APKs: RSA, or ECDSA on P-256 or P-384.
Implementations§
Source§impl PrivateKey
impl PrivateKey
Sourcepub fn from_pkcs8_der(der: &[u8]) -> Result<Self, KeyError>
pub fn from_pkcs8_der(der: &[u8]) -> Result<Self, KeyError>
Parses a PKCS#8 PrivateKeyInfo (PEM label PRIVATE KEY).
Sourcepub fn from_pkcs1_der(der: &[u8]) -> Result<Self, KeyError>
pub fn from_pkcs1_der(der: &[u8]) -> Result<Self, KeyError>
Parses a PKCS#1 RSAPrivateKey (PEM label RSA PRIVATE KEY).
Sourcepub fn from_sec1_der(der: &[u8]) -> Result<Self, KeyError>
pub fn from_sec1_der(der: &[u8]) -> Result<Self, KeyError>
Parses a SEC1 ECPrivateKey (PEM label EC PRIVATE KEY) on P-256 or P-384.
pub fn kind(&self) -> KeyKind
Sourcepub fn to_pkcs8_der(&self) -> Result<Zeroizing<Vec<u8>>, KeyError>
pub fn to_pkcs8_der(&self) -> Result<Zeroizing<Vec<u8>>, KeyError>
Encodes this key as an unencrypted PKCS#8 PrivateKeyInfo, for
exporting it to other tools. Handle the result as secret material.
pub fn public_key(&self) -> PublicKey
Sourcepub fn signature_algorithm(&self) -> SignatureAlgorithm
pub fn signature_algorithm(&self) -> SignatureAlgorithm
The v2 algorithm apksigner chooses for this key: SHA-512 variants for RSA keys over 3072 bits and EC keys over 256 bits.
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone 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 UnsafeUnpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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