Skip to content

Commit

Permalink
Fix line ending of dynamic key generated
Browse files Browse the repository at this point in the history
Use CRLF on windows and `\n` on Linux.

Also fix formatting of `Cargo.toml`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
  • Loading branch information
NobodyXu authored and drahnr committed Feb 4, 2025
1 parent 916ec70 commit c59cb89
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,21 @@ hyper-util = { version = "0.1.3", optional = true, features = [
"tokio",
"server",
] }
itertools = "0.12"
hickory-resolver = { version = "0.24", features = [
"dnssec-ring",
"dns-over-rustls",
"dns-over-https-rustls",
], optional = true }
is-terminal = "0.4.7"
itertools = "0.12"
jobserver = "0.1"
jwt = { package = "jsonwebtoken", version = "9", optional = true }
libc = "0.2.153"
linked-hash-map = "0.5"
log = "0.4"
memchr = "2"
memmap2 = "0.9.4"
mime = "0.3"
num_cpus = "1.16"
number_prefix = "0.4"
object = "0.32"
Expand All @@ -79,7 +85,6 @@ reqwest = { version = "0.12", features = [
"rustls-tls-native-roots",
"trust-dns",
], optional = true, default-features = false }
hickory-resolver = { version = "0.24", features = ["dnssec-ring", "dns-over-rustls", "dns-over-https-rustls"], optional = true }
retry = "2"
semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -89,7 +94,6 @@ shlex = "1.3.0"
strip-ansi-escapes = "0.2"
tar = "0.4.40"
tempfile = "3"
mime = "0.3"
tokio = { version = "1", features = [
"rt-multi-thread",
"io-util",
Expand Down
25 changes: 14 additions & 11 deletions src/dist/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,20 @@ pub mod urls {
mod server {
use crate::util::new_reqwest_blocking_client;
use byteorder::{BigEndian, ReadBytesExt};
use chrono::Datelike;
use chrono::Timelike;
use chrono::{Datelike, Timelike};
use flate2::read::ZlibDecoder as ZlibReadDecoder;
use once_cell::sync::Lazy;
use picky::key::{PrivateKey, PublicKey};
use picky::x509::certificate::CertificateBuilder;
use picky::x509::date::UTCDate;
use picky::x509::extension::ExtendedKeyUsage;
use picky::x509::name::{DirectoryName, GeneralNames};
use picky::{hash::HashAlgorithm, signature::SignatureAlgorithm};
use picky::{
hash::HashAlgorithm,
key::{PrivateKey, PublicKey},
signature::SignatureAlgorithm,
x509::{
certificate::CertificateBuilder,
date::UTCDate,
extension::ExtendedKeyUsage,
name::{DirectoryName, GeneralNames},
},
};
use rand::{rngs::OsRng, RngCore};
use rouille::accept;
use serde::Serialize;
Expand Down Expand Up @@ -309,10 +313,9 @@ mod server {

fn create_https_cert_and_privkey(addr: SocketAddr) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>)> {
let mut rng = OsRng;
let bits = 2048;
let rsa_key = rsa::RsaPrivateKey::new(&mut rng, bits)?;
let rsa_key = rsa::RsaPrivateKey::new(&mut rng, 2048)?;

let line_ending = rsa::pkcs8::LineEnding::CRLF;
let line_ending = rsa::pkcs8::LineEnding::Default();
let sk_pkcs8 = rsa::pkcs8::EncodePrivateKey::to_pkcs8_pem(&rsa_key, line_ending)?;
let pk_pkcs8 =
rsa::pkcs8::EncodePublicKey::to_public_key_pem(rsa_key.as_ref(), line_ending)?;
Expand Down

0 comments on commit c59cb89

Please # to comment.