file(1) magic pattern for age

99 views
Skip to first unread message

aerth

unread,
May 28, 2020, 12:40:04 AM5/28/20
to age...@googlegroups.com
I created a (very) basic magic pattern so that file(1) can tell the user
that a data file was created with age (without the ascii armored, we get
the version number too). I didn't add a MIME type.

Sample outputs:

/tmp/age.txt: age encrypted data (ascii armored)
/tmp/age.dat: age encrypted data Version: 1

To add this to your magic database, create the /etc/file/magic/age file
and run the following line, as root:

# cd /etc/file && /usr/bin/file --compile

--- The rest of this message is the contents of /etc/file/magic/age ---

#------------------------------------------------------------------------------
# $File: age,v 1.1 2020/05/28 16:20:00 aerth Exp $
# age: file(1) magic for age encryption files
#
# format spec: https://age-encryption.org/v1

0 string -----BEGIN\040AGE\040 age encrypted data (ascii armored)
0 string age-encryption.org/ age encrypted data
>20 string x Version: %s

br...@bsull.com

unread,
May 28, 2020, 1:06:56 AM5/28/20
to aerth, age...@googlegroups.com
Very cool! I use file all the time, this will surely be useful.

Cheers

Brady Sullivan

> On May 27, 2020, at 21:40, aerth <ae...@memeware.net> wrote:
>
> I created a (very) basic magic pattern so that file(1) can tell the user that a data file was created with age (without the ascii armored, we get the version number too). I didn't add a MIME type.
> --
> You received this message because you are subscribed to the Google Groups "age-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to age-dev+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/age-dev/8a30e7ee-3f39-2196-8c56-6051f0aa30fd%40memeware.net.

Jack Grigg

unread,
May 28, 2020, 3:33:02 AM5/28/20
to aerth, age-dev
Very nice!

Note that per the age specification, the version arbitrary string in the first line begins immediately after the "/", so the current age format version is "v1", not "1". Future formats could have any version string here, e.g. "squeamish-ossifrage" is a valid version. So it would be great to update this to not assume a "v" prefix.

Cheers,
Jack

Reply all
Reply to author
Forward
0 new messages