1 parent
96a32ea8fb
commit
a643e7e3ab
106 files changed
+2223
-4669
No files matched your search
@@ -126,7 +126,7 @@ async fn https_get_address(
|
||||
format!("{host}:{port}")
|
||||
};
|
||||
let request = format!(
|
||||
"GET {target} HTTP/1.1\r\nHost: {host_header}\r\nUser-Agent: RustBox/0.0.4\r\nAccept: application/octet-stream, application/pgp-keys, text/plain\r\nConnection: close\r\n\r\n"
|
||||
"GET {target} HTTP/1.1\r\nHost: {host_header}\r\nUser-Agent: RustBox/0.0.5\r\nAccept: application/octet-stream, application/pgp-keys, text/plain\r\nConnection: close\r\n\r\n"
|
||||
);
|
||||
timeout(duration, stream.write_all(request.as_bytes()))
|
||||
.await
|
||||
|
||||
@@ -78,8 +78,6 @@ pub fn generate_key(name: &str, email: &str, passphrase: &str) -> Result<Importe
|
||||
}
|
||||
|
||||
pub fn import_key(data: &[u8]) -> Result<ImportedKey, String> {
|
||||
// rPGP exposes separate helpers for ASCII armor and binary packet streams.
|
||||
// Accept both so keys exported by GnuPG, Thunderbird and WKD/HKP all work.
|
||||
let armored = data.starts_with(b"-----BEGIN PGP");
|
||||
if armored {
|
||||
let text = std::str::from_utf8(data)
|
||||
@@ -171,9 +169,6 @@ pub fn sign_detached(data: &[u8], secret_armor: &str, passphrase: &str) -> Resul
|
||||
}
|
||||
|
||||
pub fn test_secret_key_passphrase(secret_armor: &str, passphrase: &str) -> Result<(), String> {
|
||||
// The key is never modified and the passphrase is not persisted. A short
|
||||
// detached signature forces rPGP to unlock the private signing material.
|
||||
// RustBox-generated keys always have a signing-capable primary key.
|
||||
sign_detached(
|
||||
b"RustBox OpenPGP unlock self-test",
|
||||
secret_armor,
|
||||
@@ -374,9 +369,6 @@ pub fn store_secret_key(
|
||||
fs::create_dir_all(&dir).map_err(|e| format!("Failed to create PGP key directory: {e}"))?;
|
||||
set_dir_permissions(&dir)?;
|
||||
|
||||
// Reject path/control punctuation before normalization. `normalize_fingerprint`
|
||||
// intentionally strips formatting characters, so validating only its output
|
||||
// would turn values such as "../../escape" into a short hexadecimal string.
|
||||
if fingerprint.is_empty()
|
||||
|| !fingerprint
|
||||
.chars()
|
||||
@@ -410,9 +402,6 @@ pub fn delete_secret_key(path: &str) -> Result<(), String> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Change the passphrase protecting an existing private key without exposing
|
||||
/// passphrases in argv/environment. rPGP validates both the old and resulting
|
||||
/// key; GnuPG is used only as a mature secret-packet re-wrapping engine.
|
||||
pub fn change_secret_key_passphrase(
|
||||
data_dir: &str,
|
||||
user_hash: &str,
|
||||
@@ -680,10 +669,6 @@ pub fn looks_like_openpgp(raw: &[u8]) -> bool {
|
||||
|| lower.contains("-----begin pgp signed message-----")
|
||||
}
|
||||
|
||||
/// Process an OpenPGP/MIME or inline OpenPGP message. The caller supplies
|
||||
/// private key armor candidates and the public keyring. Passphrases are never
|
||||
/// persisted; one request may try the same supplied passphrase against every
|
||||
/// candidate key.
|
||||
pub fn process_message(
|
||||
raw: &[u8],
|
||||
secret_armors: &[String],
|
||||
|
||||
Reference in new issue
Block a user