Expand description
EJSON - Encrypted JSON secrets management.
This crate provides utilities for managing encrypted secrets in source control using public-key cryptography (NaCl Box).
Supports JSON (.ejson, .json), TOML (.etoml, .toml), and YAML (.eyaml, .eyml, .yaml, .yml) file formats.
§Security Features
- Private keys are zeroized from memory when dropped
- File operations use locking to prevent race conditions
- Path traversal attacks are prevented through validation
- Maximum file size limits prevent denial of service
- Constant-time comparisons for key validation
Re-exports§
pub use crypto::KeyBytes;pub use format::FileFormat;pub use handler::FormatError;pub use handler::FormatHandler;pub use handler::KEY_SIZE;pub use handler::PUBLIC_KEY_FIELD;pub use typed::DecryptedContent;pub use typed::DecryptedValue;
Modules§
- boxed_
message - Wire format for encrypted messages.
- crypto
- Cryptographic operations for ejson using NaCl Box (Curve25519 + XSalsa20 + Poly1305).
- env
- Environment variable export utilities for EJSON/EYAML/ETOML files.
- format
- File format detection for ejson files.
- handler
- Format handler trait for unified file format support.
- json
- JSON processing for ejson files.
- toml
- TOML processing for etoml files.
- typed
- Typed API for working with decrypted content.
- yaml
- YAML processing for eyaml files.
Enums§
- Ejson
Error - Errors that can occur during ejson operations.
Constants§
- MAX_
FILE_ SIZE - Maximum file size for encryption/decryption operations (10 MB). This prevents denial of service through memory exhaustion.
Functions§
- decrypt
- Decrypt data from a reader and write to a writer.
- decrypt_
bytes_ typed - Decrypt bytes and return the decrypted contents as a typed value.
- decrypt_
file - Decrypt a file and return the decrypted contents.
- decrypt_
file_ typed - Decrypt a file and return the decrypted contents as a typed value.
- decrypt_
with_ format - Decrypt data with a specific format.
- encrypt
- Encrypt data from a reader and write to a writer.
- encrypt_
file_ in_ place - Encrypt a file in place with file locking.
- encrypt_
with_ format - Encrypt data with a specific format.
- generate_
keypair - Generate a new ejson keypair.