pub struct SERVER_KEY { /* private fields */ }Expand description
RSA private key used by the server
Methods from Deref<Target = RsaPrivateKey>§
Sourcepub fn to_public_key(&self) -> RsaPublicKey
pub fn to_public_key(&self) -> RsaPublicKey
Get the public key from the private key, cloning n and e.
Generally this is not needed since RsaPrivateKey implements the PublicKey trait,
but it can occasionally be useful to discard the private information entirely.
Sourcepub fn crt_coefficient(&self) -> Option<BigUint>
pub fn crt_coefficient(&self) -> Option<BigUint>
Compute CRT coefficient: (1/q) mod p.
Sourcepub fn validate(&self) -> Result<(), Error>
pub fn validate(&self) -> Result<(), Error>
Performs basic sanity checks on the key.
Returns Ok(()) if everything is good, otherwise an appropriate error.
Sourcepub fn decrypt(
&self,
padding: PaddingScheme,
ciphertext: &[u8],
) -> Result<Vec<u8>, Error>
pub fn decrypt( &self, padding: PaddingScheme, ciphertext: &[u8], ) -> Result<Vec<u8>, Error>
Decrypt the given message.
Sourcepub fn decrypt_blinded<R>(
&self,
rng: &mut R,
padding: PaddingScheme,
ciphertext: &[u8],
) -> Result<Vec<u8>, Error>
pub fn decrypt_blinded<R>( &self, rng: &mut R, padding: PaddingScheme, ciphertext: &[u8], ) -> Result<Vec<u8>, Error>
Decrypt the given message.
Uses rng to blind the decryption process.
Sourcepub fn sign(
&self,
padding: PaddingScheme,
digest_in: &[u8],
) -> Result<Vec<u8>, Error>
pub fn sign( &self, padding: PaddingScheme, digest_in: &[u8], ) -> Result<Vec<u8>, Error>
Sign the given digest.
Sourcepub fn sign_with_rng<R>(
&self,
rng: &mut R,
padding: PaddingScheme,
digest_in: &[u8],
) -> Result<Vec<u8>, Error>
pub fn sign_with_rng<R>( &self, rng: &mut R, padding: PaddingScheme, digest_in: &[u8], ) -> Result<Vec<u8>, Error>
Sign the given digest using the provided rng
Use rng for signature process.
Methods from Deref<Target = RsaPublicKey>§
pub const MIN_PUB_EXPONENT: u64 = 2
pub const MAX_PUB_EXPONENT: u64
pub const MAX_SIZE: usize = 4096
Trait Implementations§
Source§impl Deref for SERVER_KEY
impl Deref for SERVER_KEY
Source§type Target = RsaPrivateKey
type Target = RsaPrivateKey
The resulting type after dereferencing.
Source§fn deref(&self) -> &RsaPrivateKey
fn deref(&self) -> &RsaPrivateKey
Dereferences the value.
impl LazyStatic for SERVER_KEY
Auto Trait Implementations§
impl Freeze for SERVER_KEY
impl RefUnwindSafe for SERVER_KEY
impl Send for SERVER_KEY
impl Sync for SERVER_KEY
impl Unpin for SERVER_KEY
impl UnsafeUnpin for SERVER_KEY
impl UnwindSafe for SERVER_KEY
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