Consistently refer to "age files"

This commit is contained in:
Jack Grigg 2020-03-23 23:29:03 +13:00
parent bbd617cec5
commit cf2025c60b
7 changed files with 15 additions and 15 deletions

View file

@ -11,7 +11,7 @@ use crate::util::LINE_ENDING;
const SHORT_OUTPUT_LENGTH: usize = 20 * 80;
const TRUNCATED_TTY_MSG: &[u8] =
b"[truncated; use a pipe, a redirect, or -o/--output to see full message]";
b"[truncated; use a pipe, a redirect, or -o/--output to decrypt the entire file]";
#[derive(Debug)]
struct DenyBinaryOutputError;

View file

@ -6,9 +6,9 @@ use std::io;
/// The various errors that can be returned during the decryption process.
#[derive(Debug)]
pub enum Error {
/// The message failed to decrypt.
/// The age file failed to decrypt.
DecryptionFailed,
/// The message used an excessive work factor for passphrase encryption.
/// The age file used an excessive work factor for passphrase encryption.
ExcessiveWork {
/// The work factor required to decrypt.
required: u8,
@ -17,13 +17,13 @@ pub enum Error {
},
/// The age header was invalid.
InvalidHeader,
/// The MAC in the message header was invalid.
/// The MAC in the age header was invalid.
InvalidMac,
/// An I/O error occurred during decryption.
Io(io::Error),
/// Failed to decrypt an encrypted key.
KeyDecryptionFailed,
/// None of the provided keys could be used to decrypt the message.
/// None of the provided keys could be used to decrypt the age file.
NoMatchingKeys,
/// An unknown age format, probably from a newer version.
UnknownFormat,

View file

@ -1,4 +1,4 @@
//! The age message format.
//! The age file format.
use rand::{
distributions::{Distribution, Uniform},

View file

@ -49,7 +49,7 @@ impl RecipientLine {
&mut h,
Some(SSH_RSA_OAEP_LABEL.to_owned()),
)
.expect("pubkey is valid and message is not too long");
.expect("pubkey is valid and file key is not too long");
RecipientLine {
tag: ssh_tag(&ssh_key),

View file

@ -49,7 +49,7 @@ impl FileKey {
}
}
/// A secret key for decrypting an age message.
/// A secret key for decrypting an age file.
pub enum SecretKey {
/// An X25519 secret key.
X25519(StaticSecret),
@ -330,7 +330,7 @@ impl Identity {
}
}
/// A key that can be used to encrypt an age message to a recipient.
/// A key that can be used to encrypt a file to a recipient.
#[derive(Clone, Debug)]
pub enum RecipientKey {
/// An X25519 recipient key.

View file

@ -1,4 +1,4 @@
//! *Library for encrypting and decryping age messages*
//! *Library for encrypting and decryping age files*
//!
//! age is a simple, secure, and modern encryption tool with small explicit keys, no
//! config options, and UNIX-style composability.

View file

@ -128,7 +128,7 @@ impl Stream {
}
}
/// Writes an encrypted age message.
/// Writes an encrypted age file.
pub struct StreamWriter<W: Write> {
stream: Stream,
inner: ArmoredWriter<W>,
@ -197,7 +197,7 @@ enum StartPos {
Explicit(u64),
}
/// Provides access to a decrypted age message.
/// Provides access to a decrypted age file.
pub struct StreamReader<R: Read> {
stream: Stream,
inner: ArmoredReader<R>,
@ -254,14 +254,14 @@ impl<R: Read> Read for StreamReader<R> {
// Stream has ended before seeing the last chunk.
return Err(io::Error::new(
io::ErrorKind::UnexpectedEof,
"message is truncated",
"age file is truncated",
));
} else {
return Ok(0);
}
}
// This check works for all cases except when the message is an integer
// This check works for all cases except when the age file is an integer
// multiple of the chunk size. In that case, we try decrypting twice on a
// decryption failure.
let last = end < ENCRYPTED_CHUNK_SIZE;
@ -507,7 +507,7 @@ mod tests {
}
#[test]
fn stream_fails_to_decrypt_truncated_message() {
fn stream_fails_to_decrypt_truncated_file() {
let key = [7; 32];
let data = vec![42; 2 * CHUNK_SIZE];