age is a simple, secure and modern encryption tool with small explicit keys, no config options, and UNIX-style composability. The format specification is at age-encryption.org/v1.
page is a Python library using the Rust implementation of the age tool. It is pronounced like the Japanese パゲ (with a hard g).
To discuss the spec or other age related topics, please email the mailing list at [email protected]. age was designed by @Benjojo12 and @FiloSottile.
The reference interoperable Golang implementation is available at filippo.io/age. The Rust implementation is available at https://github.com/str4d/rage
You can use page's encryption functions in two ways, either using identity-based encryption:
from page import encrypt, decrypt, Identity
rc = "age1ppvqwzgdynzjmy04drg9h55xv0clhr4frtgnvy4uwkvk4jf4gu0sf63nar"
id = Identity("""
AGE-SECRET-KEY-1CZP3Q5EC25V8SK003Y8FYQNH7JPCCVMCRMZYSRX7E2JV3U0C09PSS5MEGZ
""")
encrypted_msg = encrypt(b"My Important Message", public_keys=[rc])
msg = decrypt(encrypted_msg, private_keys=[id])
assert msg == b"My Important Message"
or, using simple passphrase-based encryption:
from page import encrypt, decrypt
encrypted_msg = encrypt(b"My Important Message", passphrase="My secret password")
msg = decrypt(encrypted_msg, passphrase="My secret password")
assert msg == b"My Important Message"
Files can be encrypted to multiple recipients. Every recipient will be able to decrypt the file.
from page import encrypt, decrypt, Identity
id1 = Identity.generate()
id2 = Identity.generate()
encrypted_msg = encrypt(b"My Important Message", public_keys=[*id1.public(), *id2.public()])
msg1 = decrypt(encrypted_msg, private_keys=[id1])
msg2 = decrypt(encrypted_msg, private_keys=[id2])
assert msg1 == msg2
You can install page using pip:
$ pip install page
Help from new packagers is very welcome.
Licensed under Apache License, Version 2.0 (LICENSE)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be as defined in the Apache-2.0 license, without any additional terms or conditions.