age.rb: Ruby bindings for age
Ruby bindings for age using a CGO shared library with FFI bindings.
Age is a simple, modern, and secure file encryption tool, format, and Go library. This gem provides a Ruby interface to age’s encryption and decryption capabilities.
Features
- Encrypt and decrypt data using age public/private key pairs, passphrase, and SSH keys
- Encrypt and decrypt files directly
- Generate age keypairs programmatically, optionally with post-quantum keys
- Multiple recipients and identies support for encryption and decryption
- ASCII armor format support for text-safe encrypted output
- FFI-based integration with Go’s age implementation
- Binary data handling with proper encoding
Architecture
This gem uses FFI (Foreign Function Interface) to call functions from a Go
shared library (age.so). The Go code wraps the
filippo.io/age package and exposes C-compatible
functions for:
- Encrypting data with age public keys, passphrases, and SSH keys (binary and ASCII armor formats)
- Decrypting data with age private keys, passphrases, and SSH keys (binary and ASCII armor formats)
- Generating age keypairs
- Memory management
The Ruby code provides a clean, idiomatic interface to these functions with proper error handling and memory cleanup. SSH key support is provided by the filippo.io/age/agessh package. ASCII armor support is provided by the filippo.io/age/armor package.
License
The gem is available as open source under the terms of the BSD-3-Clause License.
Credits
- age - The underlying encryption tool by Filippo Valsorda
- filippo.io/age - The Go age library