pub struct KeyPair(/* private fields */);Expand description
An RSA private key.
This is not so useful at present, since Arti currently only has client support, and Tor clients never actually need RSA private keys.
Implementations§
Source§impl KeyPair
impl KeyPair
Sourcepub fn generate<R: RngCore + CryptoRng>(csprng: &mut R) -> Result<Self, Bug>
pub fn generate<R: RngCore + CryptoRng>(csprng: &mut R) -> Result<Self, Bug>
Generate a new random RSA keypair.
This is hardcoded to generate a 1024-bit keypair, since this only exists to support the RSA keys that we require for backwards compatibility (which are all 1024 bit), and we don’t anticipate adding anything new that uses RSA in the future.
Sourcepub fn to_public_key(&self) -> PublicKey
pub fn to_public_key(&self) -> PublicKey
Return the public component of this key.
Sourcepub fn sign(&self, message: &[u8]) -> Result<Vec<u8>, Error>
pub fn sign(&self, message: &[u8]) -> Result<Vec<u8>, Error>
Sign a message using this keypair.
This uses PKCS#1 v1.5 padding and takes a raw bytes, rather than doing the hashing internally. This is because we use PKCS padding without specifying the hash OID, which is a slightly unusual setup that is understandably not supported by the rsa crate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyPair
impl RefUnwindSafe for KeyPair
impl Send for KeyPair
impl Sync for KeyPair
impl Unpin for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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