Make rsa::{self, public::{self, *}}
public.
This commit is contained in:
parent
6a6ea5893e
commit
e05f7e1273
@ -105,7 +105,7 @@ pub mod pkcs8;
|
||||
pub mod rand;
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
mod rsa;
|
||||
pub mod rsa;
|
||||
|
||||
pub mod signature;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
// naming conventions. Also the standard camelCase names are used for `KeyPair`
|
||||
// components.
|
||||
|
||||
//! Low-level RSA primitives.
|
||||
//! RSA.
|
||||
|
||||
use crate::{
|
||||
arithmetic::bigint,
|
||||
|
@ -12,7 +12,7 @@
|
||||
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
//! Low-level RSA public key API.
|
||||
//! RSA public keys.
|
||||
|
||||
mod components;
|
||||
mod exponent;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::error;
|
||||
use core::num::NonZeroU64;
|
||||
|
||||
/// The exponent `e` of the RSA public key.
|
||||
/// The exponent `e` of an RSA public key.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Exponent(NonZeroU64);
|
||||
|
||||
@ -30,7 +30,7 @@ impl Exponent {
|
||||
// stable.
|
||||
const MAX: Self = Self(unsafe { NonZeroU64::new_unchecked((1u64 << 33) - 1) });
|
||||
|
||||
pub fn from_be_bytes(
|
||||
pub(super) fn from_be_bytes(
|
||||
input: untrusted::Input,
|
||||
min_value: Self,
|
||||
) -> Result<Self, error::KeyRejected> {
|
||||
|
@ -15,6 +15,7 @@
|
||||
use super::{Exponent, Modulus};
|
||||
use crate::{bits, error};
|
||||
|
||||
/// An RSA Public Key.
|
||||
#[derive(Debug)]
|
||||
pub struct Key {
|
||||
n: Modulus,
|
||||
@ -22,7 +23,7 @@ pub struct Key {
|
||||
}
|
||||
|
||||
impl Key {
|
||||
pub fn from_modulus_and_exponent(
|
||||
pub(in super::super) fn from_modulus_and_exponent(
|
||||
n: untrusted::Input,
|
||||
e: untrusted::Input,
|
||||
n_min_bits: bits::BitLength,
|
||||
@ -52,10 +53,14 @@ impl Key {
|
||||
Ok(Self { n, e })
|
||||
}
|
||||
|
||||
/// The public modulus.
|
||||
#[inline]
|
||||
pub fn n(&self) -> &Modulus {
|
||||
&self.n
|
||||
}
|
||||
|
||||
/// The public exponent.
|
||||
#[inline]
|
||||
pub fn e(&self) -> Exponent {
|
||||
self.e
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::{arithmetic::bigint, bits, error, rsa::N};
|
||||
use core::ops::RangeInclusive;
|
||||
|
||||
/// The modulus (n) of an RSA public key.
|
||||
pub struct Modulus {
|
||||
value: bigint::Modulus<N>,
|
||||
bits: bits::BitLength,
|
||||
|
Loading…
x
Reference in New Issue
Block a user