Commit Graph

43 Commits

Author SHA1 Message Date
Filippo Valsorda
22e598d458 age: replace ParseX25519Identities with ParseIdentities
The latter returns a []Identity that can be used with Decrypt directly.
2020-09-20 12:54:15 +02:00
Filippo Valsorda
65f171a239 age: add ParseX25519Identities and key management docs 2020-09-20 12:17:15 +02:00
Filippo Valsorda
2194f6962c age: mitigate multi-key attacks on ChaCha20Poly1305
It's possible to craft ChaCha20Poly1305 ciphertexts that decrypt under
multiple keys. (I know, it's wild.)

The impact is different for different recipients, but in general only
applies to Chosen Ciphertext Attacks against online decryption oracles:

* With the scrypt recipient, it lets the attacker make a recipient
  stanza that decrypts with multiple passwords, speeding up a bruteforce
  in terms of oracle queries (but not scrypt work, which can be
  precomputed) to logN by binary search.

  Limiting the ciphertext size limits the keys to two, which makes this
  acceptable: it's a loss of only one bit of security in a scenario
  (online decryption oracles) that is not recommended.

* With the X25519 recipient, it lets the attacker search for accepted
  public keys without using multiple recipient stanzas in the message.
  That lets the attacker bypass the 20 recipients limit (which was not
  actually intended to defend against deanonymization attacks).

  This is not really in the threat model for age: we make no attempt to
  provide anonymity in an online CCA scenario.

  Anyway, limiting the keys to two by enforcing short ciphertexts
  mitigates the attack: it only lets the attacker test 40 keys per
  message instead of 20.

* With the ssh-ed25519 recipient, the attack should be irrelevant, since
  the recipient stanza includes a 32-bit hash of the public key, making
  it decidedly not anonymous.

  Also to avoid breaking the abstraction in the agessh package, we don't
  mitigate the attack for this recipient, but we document the lack of
  anonymity.

This was reported by Paul Grubbs in the context of the upcoming paper
"Partitioning Oracle Attacks", USENIX Security 2021 (to appear), by
Julia Len, Paul Grubbs, and Thomas Ristenpart.
2020-09-19 18:52:59 +02:00
Filippo Valsorda
189041b668 age: move package from filippo.io/age/age to filippo.io/age 🤦‍♂️ 2020-06-27 22:06:32 -04:00
Filippo Valsorda
e609359651 age,agessh,armor: unleash public API 💥🦑 2020-06-27 21:08:42 -04:00
Filippo Valsorda
9b83d948f5 internal/age: surface format.Recipient as type Stanza 2020-06-27 19:44:26 -04:00
Filippo Valsorda
c9a35c0727 internal/agessh: move EncryptedSSHIdentity out of cmd/age 2020-05-19 02:07:27 -04:00
Filippo Valsorda
6782356e45 internal/age: add some docs and polish API 2020-05-18 02:53:37 -04:00
Filippo Valsorda
292c3aaeea internal/agessh: new package
Move the SSH recipient types out of the main package to declutter the
godoc. This also allows us to drop the x/crypto/ssh build dependency
entirely from the age package import tree.
2020-05-18 01:20:08 -04:00
Filippo Valsorda
b32ea4c1f6 cmd/age: add a TODO about not dumping decrypted binary to the terminal 2020-05-18 00:21:41 -04:00
Filippo Valsorda
c7c7f1870f internal/armor: new package 2020-05-18 00:12:36 -04:00
Filippo Valsorda
a7c4274d23 internal/age: remove EncryptWithArmor and armor support in Decrypt
The caller can take care of the armor. For consistency move the
responsibility to close the armor to the caller, and make the stream
Writer not propagate Close.

This also will also allow us to spin the armor implementation out into
its won package that imports format, without getting an import loop from
format.Parse magically invoking armor decoding.

Less magic in the API, more magic in the CLI.
2020-05-18 00:11:21 -04:00
Filippo Valsorda
7088a73234 internal/age: unexport SSHFingerprint 2020-05-18 00:05:25 -04:00
Filippo Valsorda
f54bb8daab internal/format: don't generate and reject empty lines in recipient bodies
Detected by https://github.com/str4d/rage/runs/532262359 and by go-fuzz.
2020-03-25 02:22:58 -04:00
Filippo Valsorda
9fdb125641 go.mod: switch to upstream golang.org/x/crypto
Fixes #99
2020-02-04 14:14:08 -05:00
Filippo Valsorda
e43cf8b4a2 cmd/age: improve incorrect passphrase error message
Fixes #41
2019-12-31 14:20:39 +01:00
Filippo Valsorda
dd887fdc87 cmd/age: confirm encryption passphrase
Fixes #39
2019-12-30 00:41:53 +01:00
Filippo Valsorda
80c6b4edd9 cmd/age: offer to autogenerate a secure passphrase
As suggested by @tqbf: https://twitter.com/tqbf/status/1210715916381511680
2019-12-30 00:23:22 +01:00
Chris Palmer
d6fe1cf5c8 cmd/age: provide a --output option (#28)
For consistency across all options.
2019-12-28 02:33:26 +01:00
Filippo Valsorda
1bf22e2163 cmd/age-keygen: print the public key to standard error 2019-12-27 23:49:09 +01:00
Filippo Valsorda
3d73da544d cmd/age: add -help and README 2019-12-27 23:48:29 +01:00
Filippo Valsorda
158b2ce899 all: switch labels and intro to age-encryption.org/v1 2019-12-27 17:13:20 +01:00
Filippo Valsorda
9a84e437b1 all: switch key format to Bech32
Use the BIP173 format, which is whole-word selectable, markup safe, and
case insensitive.

AGE-SECRET-KEY-1FPSHVEFQXYSX5MMFDE6ZCGRTV4JHQGRFWSS8WETVDSSX76TVV4JQU272CR

See https://groups.google.com/d/msg/age-dev/UAjkvLoCr9I/l4Q1h3OPAgAJ.

All bech32 Go packages have funky APIs, internal types, or case
handling, so include a heavily refactored version of the reference
implementation, and the tests from github.com/btcsuite/btcutil/bech32.
2019-12-27 17:13:20 +01:00
Filippo Valsorda
8c600131ec cmd/age: print age-tool.com/report link on errors 2019-12-07 01:19:02 -05:00
Filippo Valsorda
0369d9b7fb cmd/age-keygen: detect world-readable output file 2019-12-07 00:59:41 -05:00
Filippo Valsorda
93ea79628d all: change module name to filippo.io/age
No need to tie ourselves to GitHub.

The redirect is not set up yet, but as long as there is a replace in the
go.mod the tool can't be installed with "go get" anyway.

Not using age-tool.com because A) I don't actually like the domain and
B) it should be about the spec not the specific implementation.
2019-12-07 00:59:41 -05:00
Filippo Valsorda
aefae7ca0f cmd/age: autodetect --passphrase in --decrypt mode 2019-12-07 00:59:41 -05:00
Filippo Valsorda
470186da64 cmd/age: implement -p/--passphrase 2019-12-07 00:59:41 -05:00
Filippo Valsorda
a070570595 cmd/age: don't worry about sending decryption output to the terminal 2019-11-27 22:55:29 -04:00
Filippo Valsorda
025d8d5c0b cmd/age: fix support for password-protected ssh-ed25519 keys 2019-11-27 22:54:24 -04:00
Filippo Valsorda
03f7237541 internal/age: refactor to use the new golang.org/x/crypto/curve25519 API 2019-11-27 22:49:40 -04:00
Filippo Valsorda
f90681e0df cmd/age: detect output to the terminal and require opt-in or armor
Also, buffer the armor, so it doesn't get in the way of typing.
2019-11-27 19:40:59 -04:00
Filippo Valsorda
5ea3ee2f63 cmd/age: revamp CLI with -r/-i, long options, and input arg 2019-11-27 19:40:41 -04:00
Filippo Valsorda
779b033c8b cmd/age-keygen: move to a standalone binary 2019-11-27 18:56:08 -04:00
Filippo Valsorda
4c4e446f72 internal/age,internal/format: implement armored file generation 2019-11-24 21:10:57 -05:00
Filippo Valsorda
c624abc0ad cmd/age: add support for encrypted SSH key files 2019-11-24 19:15:53 -05:00
Filippo Valsorda
2cc62919a6 cmd/age: refactor parseIdentitiesFile 2019-10-17 10:31:44 -04:00
Filippo Valsorda
8f7e6dcd45 cmd/age: detect age and SSH private keys from file contents 2019-10-14 21:43:48 -04:00
Filippo Valsorda
a5bf40786d cmd/age: add -i and -o flags 2019-10-14 21:09:11 -04:00
Filippo Valsorda
2a0aef5803 internal/age: use a prototype of X25519 from golang/go#32670 2019-10-13 18:14:54 -04:00
Artyom Pervukhin
2d009c8eaf cmd/age: add missing close in parseIdentitiesFile (#14) 2019-10-13 16:34:09 -04:00
Matt Layher
dd0939ffaa cmd/age: initial support for SSH identities and recipients
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-10-07 22:14:24 -04:00
Filippo Valsorda
0940f184fb cmd/age: add a prototype of the command line tool 2019-10-06 23:16:20 -04:00