92 Commits
Author SHA1 Message Date
706dfc1e79 all: minor cleanups (#700)
Replace two hand-rolled slicesEqual helpers with slices.Equal from
the standard library, which is already imported in age.go.
(age.go:211-221, plugin/plugin.go:666-676)

Fix godoc link typo [Indentity] -> [Identity].
(plugin/plugin.go:3)

Fix comment typo "not MinPayload" -> "so MinPayload".
(internal/inspect/inspect.go:25)

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-20 22:12:32 +01:00
4c86929a84 internal/format: return correct byte count from writeWrapped (#698)
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-20 22:02:09 +01:00
db09cd66d1 internal/inspect: fix tag stanza type names in post-quantum classifier (#695)
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-20 21:49:27 +01:00
Filippo Valsorda 420273952a internal/stream: fix DecryptReaderAt concurrency 2025-12-26 22:18:54 +01:00
Filippo Valsorda 2ff5d341f6 age: add DecryptReaderAt 2025-12-26 20:30:27 +01:00
Filippo Valsorda abe371e157 all: run "go fix" 2025-12-25 20:48:28 +01:00
Filippo Valsorda ec92694aad age: add EncryptReader pull-based encryption API
Fixes #644
Fixes #654
Updates #638
2025-12-25 20:48:28 +01:00
Filippo ValsordaandNicolas Dumazet 92ac13f51c plugin: add NewTerminalUI
Closes #611
Closes #591

Co-authored-by: Nicolas Dumazet <nicdumz.commits@gmail.com>
2025-12-24 17:17:50 +01:00
Filippo Valsorda b4cdeef465 cmd/age: accept leading whitespace before armored data
It was already accepted by the API, but the CLI did not handle it while
peeking to detect armored input.
2025-12-23 22:23:41 +01:00
Filippo Valsorda d36e4ce2c7 cmd/age-inspect: new command
Fixes #56
Closes #501
2025-12-23 21:39:39 +01:00
Filippo Valsorda ca8a69b1b6 age: improve error on empty files
Fixes #416
2025-12-23 15:22:55 +01:00
Filippo Valsorda ae74b61b59 cmd/age,internal/stream: improve error messages 2025-12-07 20:01:09 +01:00
cda3988cc7 all: fix staticcheck warnings (#589)
Co-authored-by: Filippo Valsorda <github@bip.filippo.io>
2024-12-18 15:55:57 +01:00
Filippo Valsorda 6976c5fca5 plugin: expose package 2023-08-05 21:34:14 +02:00
Filippo Valsorda 7354aa0d08 internal/bech32: remove data length limit
Fixes #453
2022-12-23 12:28:06 +01:00
Filippo Valsorda bf8d2a3911 age: move testkit to CCTV 2022-10-28 20:11:09 +02:00
Filippo Valsorda 891be91d42 armor: add FuzzMalleability test 2022-07-03 12:48:48 +02:00
Filippo Valsorda 799c2bf8e8 tests: add armor tests 2022-07-03 12:48:48 +02:00
Filippo Valsorda e84d74239e age: wrap decryption errors through and add armor.Error 2022-07-03 12:48:48 +02:00
Filippo Valsorda 8023f06ce2 all: build tag tests that require Go 1.18 2022-06-20 22:33:31 +01:00
Filippo Valsorda 4f7bb44386 internal/format: add malleability fuzz test 2022-06-20 01:18:48 +01:00
Filippo Valsorda 3f56ac13fb internal/stream: reject trailing data (no EOF) after end of stream 2022-06-19 23:11:14 +02:00
Filippo Valsorda 2e090545df age: reject leading zeroes and sign in scrypt work factor 2022-06-19 17:52:30 +02:00
Filippo Valsorda 2088adf268 tests: add expected no match and minor additions 2022-06-19 00:11:23 +02:00
Filippo Valsorda eaa4e03cfe tests: finish parsing and X25519 tests, distinguish HMAC errors
If the implementation re-encodes the header before checking the HMAC,
that would mask malleability issues: the HMAC check would fail because
the tests HMAC'd the original header, but an attacker could also produce
the right HMAC. Instead of duplicating every parsing tests (with the
original and re-encoded HMAC), we make the test framework distinguish
HMAC errors, which ensures bad encodings are recognized as such and not
bypassable HMAC errors.
2022-06-18 13:47:00 +02:00
Filippo Valsorda f8a121dd87 tests: add more tests for hmac and X25519 encodings 2022-06-16 15:55:29 +02:00
Filippo Valsorda 92713afd1e tests: add scrypt tests and move Go files from testdata 2022-06-15 20:38:59 +02:00
Filippo Valsorda 787044bdb6 testdata: convert last chunk tests to testkit 2022-06-15 19:38:18 +02:00
Filippo Valsorda a787511e01 testdata: add a few more testkit vectors 2022-06-15 18:54:09 +02:00
Filippo Valsorda e49b1f9afe internal/testkit: new test framework 2022-06-15 18:53:07 +02:00
Filippo Valsorda 5824a13b57 cmd/age,internal/plugin: print a message if waiting on a plugin for too long 2022-05-24 15:57:42 +02:00
Filippo Valsorda c0e80ef2c9 cmd/age: improve confirm dialog
Don't require enter after the selection number, print errors as
warnings, and retry if an unexpected selection is made.
2022-05-24 15:56:22 +02:00
Filippo Valsorda eeb9a079da cmd/age: add -j option for data-less plugins
See str4d/rage#237 and str4d/rage#236
2022-05-24 15:56:22 +02:00
Filippo Valsorda 87a982b72e internal/plugin: refactor plugin handling code 2022-05-24 15:56:22 +02:00
Filippo Valsorda 5a0da177e9 internal/plugin,cmd/age: implement confirm protocol verb 2022-05-24 15:56:22 +02:00
Filippo Valsorda 349ed5ed3f cmd/age: clean up the terminal UI 2022-05-24 15:56:22 +02:00
Filippo Valsorda 384d0393e0 internal/plugin,cmd/age: add support for encrypting to plugin identities 2022-05-24 15:56:22 +02:00
Filippo Valsorda 7bad9c2ad8 internal/plugin: update to latest plugin spec
The main change is that phase 2 of the wrapping state machine is
interactive to accommodate symmetric plugins.
2022-05-24 15:56:22 +02:00
Filippo Valsorda 01b56b117c internal/plugin: complete experimental plugin support 2022-05-24 15:56:22 +02:00
Filippo Valsorda f6a5b94705 internal/plugin,cmd/age: implement preliminary plugin client support 2022-05-24 15:56:22 +02:00
Filippo Valsorda 30d8e65e03 internal/stream: disallow empty final chunks
A non-empty payload of length a multiple of the chunk size can be
encrypted in two ways: with the last chunk full, or with an extra empty
last chunk. This is mostly an oversight in the original spec.

Both age and rage generate full last chunks, so we should be still in
time to pick one of the two, and avoid the underspecification. It's not
the one I would have picked originally, maybe, because disallowing full
last chunks would have avoided the trial decryption, but oh well.
2022-05-24 15:47:13 +02:00
Filippo Valsorda 765400f0c1 internal/format: factor out a StanzaReader for use in the plugin protocol 2022-05-22 11:54:38 +02:00
Richard UlmerandGitHub f7fcbef542 internal/stream: remove unused variable from testRoundTrip (#396) 2022-04-27 07:31:48 -04:00
Helio MachadoandGitHub d717942b93 internal/format: improve error message for old header format (#398) 2022-04-26 13:30:35 -04:00
Filippo Valsorda dfa2052cb7 all: move copyright owners to AUTHORS file 2021-11-24 11:29:15 +01:00
Filippo Valsorda 6596145a2c armor: don't leave an empty line before the footer
Closes #264
Fixes #263
2021-05-26 13:35:30 +02:00
Filippo ValsordaandFilippo Valsorda 69e2222921 internal/format: drop go-fuzz test case
We were not running it in CI, so it had rotted or was going to rot.
We'll replace it with a native fuzz test once that's ready.
2021-03-10 05:38:47 -05:00
Filippo Valsorda 15df6e2cf7 internal/format: require the last line of stanzas to be short
We are going to reuse the stanza format for IPC in the plugin protocol,
but in that context we need stanzas to be self-closing. Currently they
almost are, but if the body is 0 modulo 48, there is no way to know if
the stanza is over after the last line.

Now, all stanzas have to end with a short line, even if empty.

No ciphertexts generated by age in the past are affected, but 3% of the
ciphertexts generated by rage will now stop working. They are still
supported by rage going forward. If it turns out to be a common issue,
we can add an exception.
2021-02-08 19:55:28 +01:00
Matthias SchneiderandGitHub a02075a0cc internal/stream: fix readChunk documentation (#163)
r.c was renamed to r.src.
2021-01-03 15:26:48 +01:00
Filippo ValsordaandFilippo Valsorda 02ee8b969a internal/format: buffer newlineWriter writes
Most writes in the cmd/age Writer stack are chunk-sized, so
approximately 64KiB. However, the newlineWriter, which splits lines at
64 columns, was doing a Write on the underlying Writer for each line,
making chunks effectively 48 bytes (before base64). There is no
buffering underneath it, so it was resulting in a lot of write syscalls.

Add a reusable bytes.Buffer to buffer the output of each
(*newlineWriter).Write call, and Write it all at once on the
destination.

This makes --armor just 50% slower than plain, instead of 10x.

Fixes #167
2021-01-03 09:10:21 -05:00