mirror of
https://github.com/str4d/rage.git
synced 2025-04-04 19:37:51 +03:00
Use OsRng consistently from rand
rand_os disappears part-way through the rand 0.7 series, so may as well move away from it now.
This commit is contained in:
parent
e5e883fa65
commit
e873f47c56
3 changed files with 3 additions and 5 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -40,7 +40,6 @@ dependencies = [
|
||||||
"nom 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"nom 5.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-bigint-dig 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-bigint-dig 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rsa 0.1.4-alpha.0 (git+https://github.com/lucdew/RSA?branch=oaep)",
|
"rsa 0.1.4-alpha.0 (git+https://github.com/lucdew/RSA?branch=oaep)",
|
||||||
"scrypt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"scrypt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -26,7 +26,6 @@ hkdf = "0.8"
|
||||||
hmac = "0.7"
|
hmac = "0.7"
|
||||||
nom = "5"
|
nom = "5"
|
||||||
num-bigint-dig = "0.4"
|
num-bigint-dig = "0.4"
|
||||||
rand_os = "0.1"
|
|
||||||
rand = "0.6"
|
rand = "0.6"
|
||||||
rsa = { git = "https://github.com/lucdew/RSA", branch = "oaep" }
|
rsa = { git = "https://github.com/lucdew/RSA", branch = "oaep" }
|
||||||
scrypt = { version = "0.2", default-features = false }
|
scrypt = { version = "0.2", default-features = false }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! Key structs and serialization.
|
//! Key structs and serialization.
|
||||||
|
|
||||||
use curve25519_dalek::edwards::EdwardsPoint;
|
use curve25519_dalek::edwards::EdwardsPoint;
|
||||||
use rand_os::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use sha2::{Digest, Sha256, Sha512};
|
use sha2::{Digest, Sha256, Sha512};
|
||||||
use std::io::{self, BufRead};
|
use std::io::{self, BufRead};
|
||||||
use x25519_dalek::{EphemeralSecret, PublicKey, StaticSecret};
|
use x25519_dalek::{EphemeralSecret, PublicKey, StaticSecret};
|
||||||
|
@ -106,7 +106,7 @@ impl SecretKey {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut rng = rand::rngs::OsRng::new().expect("should have RNG");
|
let mut rng = OsRng::new().expect("should have RNG");
|
||||||
let mut h = Sha256::default();
|
let mut h = Sha256::default();
|
||||||
|
|
||||||
rsa::oaep::decrypt(
|
rsa::oaep::decrypt(
|
||||||
|
@ -226,7 +226,7 @@ impl RecipientKey {
|
||||||
RecipientLine::x25519(epk, encrypted_file_key)
|
RecipientLine::x25519(epk, encrypted_file_key)
|
||||||
}
|
}
|
||||||
RecipientKey::SshRsa(ssh_key, pk) => {
|
RecipientKey::SshRsa(ssh_key, pk) => {
|
||||||
let mut rng = rand::rngs::OsRng::new().expect("should have RNG");
|
let mut rng = OsRng::new().expect("should have RNG");
|
||||||
let mut h = Sha256::default();
|
let mut h = Sha256::default();
|
||||||
|
|
||||||
let encrypted_file_key = rsa::oaep::encrypt(
|
let encrypted_file_key = rsa::oaep::encrypt(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue