Switch to using for all crate level uses
This commit is contained in:
parent
f2399316bf
commit
bbd63fbba4
@ -3,8 +3,8 @@ use num_bigint::{BigUint, RandPrime};
|
|||||||
use num_traits::{FromPrimitive, One, Zero};
|
use num_traits::{FromPrimitive, One, Zero};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
use errors::{Error, Result};
|
use crate::errors::{Error, Result};
|
||||||
use key::RSAPrivateKey;
|
use crate::key::RSAPrivateKey;
|
||||||
|
|
||||||
/// Default exponent for RSA keys.
|
/// Default exponent for RSA keys.
|
||||||
const EXP: u64 = 65537;
|
const EXP: u64 = 65537;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use errors::{Error, Result};
|
use crate::errors::{Error, Result};
|
||||||
use key::{PublicKey, RSAPrivateKey};
|
use crate::key::{PublicKey, RSAPrivateKey};
|
||||||
use num_bigint::{BigInt, BigUint, ModInverse, RandBigInt, Sign::Plus};
|
use num_bigint::{BigInt, BigUint, ModInverse, RandBigInt, Sign::Plus};
|
||||||
use num_traits::{One, Signed, Zero};
|
use num_traits::{One, Signed, Zero};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
12
src/key.rs
12
src/key.rs
@ -7,11 +7,11 @@ use rand::{Rng, ThreadRng};
|
|||||||
#[cfg(feature = "serde1")]
|
#[cfg(feature = "serde1")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use algorithms::generate_multi_prime_key;
|
use crate::algorithms::generate_multi_prime_key;
|
||||||
use errors::{Error, Result};
|
use crate::errors::{Error, Result};
|
||||||
use hash::Hash;
|
use crate::hash::Hash;
|
||||||
use padding::PaddingScheme;
|
use crate::padding::PaddingScheme;
|
||||||
use pkcs1v15;
|
use crate::pkcs1v15;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref MIN_PUB_EXPONENT: BigUint = BigUint::from_u64(2).unwrap();
|
static ref MIN_PUB_EXPONENT: BigUint = BigUint::from_u64(2).unwrap();
|
||||||
@ -445,7 +445,7 @@ pub fn check_public(public_key: &impl PublicKey) -> Result<()> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use internals;
|
use crate::internals;
|
||||||
use num_traits::{FromPrimitive, ToPrimitive};
|
use num_traits::{FromPrimitive, ToPrimitive};
|
||||||
use rand::{thread_rng, ThreadRng};
|
use rand::{thread_rng, ThreadRng};
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@ use num_bigint::BigUint;
|
|||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};
|
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};
|
||||||
|
|
||||||
use errors::{Error, Result};
|
use crate::errors::{Error, Result};
|
||||||
use hash::Hash;
|
use crate::hash::Hash;
|
||||||
use internals;
|
use crate::internals;
|
||||||
use key::{self, PublicKey, RSAPrivateKey};
|
use crate::key::{self, PublicKey, RSAPrivateKey};
|
||||||
|
|
||||||
// Encrypts the given message with RSA and the padding
|
// Encrypts the given message with RSA and the padding
|
||||||
// scheme from PKCS#1 v1.5. The message must be no longer than the
|
// scheme from PKCS#1 v1.5. The message must be no longer than the
|
||||||
@ -243,9 +243,9 @@ mod tests {
|
|||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
use sha1::{Digest, Sha1};
|
use sha1::{Digest, Sha1};
|
||||||
|
|
||||||
use hash::Hashes;
|
use crate::hash::Hashes;
|
||||||
use key::RSAPublicKey;
|
use crate::key::RSAPublicKey;
|
||||||
use padding::PaddingScheme;
|
use crate::padding::PaddingScheme;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_non_zero_bytes() {
|
fn test_non_zero_bytes() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user