{"id":29260078,"url":"https://github.com/a-jean-andreasian/file-encryptor-for-ruby","last_synced_at":"2026-04-30T10:08:58.182Z","repository":{"id":258239380,"uuid":"873607636","full_name":"a-jean-andreasian/File-Encryptor-for-Ruby","owner":"a-jean-andreasian","description":"openssl-based file encryptor for Ruby","archived":false,"fork":false,"pushed_at":"2024-10-16T14:21:00.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-24T11:42:28.537Z","etag":null,"topics":["encryption","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a-jean-andreasian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-16T13:00:23.000Z","updated_at":"2024-10-16T14:21:44.000Z","dependencies_parsed_at":"2024-10-18T05:06:35.771Z","dependency_job_id":"0460e25d-13aa-4628-aad8-e222f7d13c9e","html_url":"https://github.com/a-jean-andreasian/File-Encryptor-for-Ruby","commit_stats":null,"previous_names":["armen-jean-andreasian/env-files-encryptor-for-ruby","a-jean-andreasian/file-encryptor-for-ruby"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/a-jean-andreasian/File-Encryptor-for-Ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-jean-andreasian%2FFile-Encryptor-for-Ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-jean-andreasian%2FFile-Encryptor-for-Ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-jean-andreasian%2FFile-Encryptor-for-Ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-jean-andreasian%2FFile-Encryptor-for-Ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a-jean-andreasian","download_url":"https://codeload.github.com/a-jean-andreasian/File-Encryptor-for-Ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-jean-andreasian%2FFile-Encryptor-for-Ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32460940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encryption","rails","ruby"],"created_at":"2025-07-04T07:07:33.323Z","updated_at":"2026-04-30T10:08:57.884Z","avatar_url":"https://github.com/a-jean-andreasian.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Encryptor for Ruby\n\n---\n## Intro\n\nThis script encrypts your files using **AES-256-CBC** with a custom `key`, deletes them (optionally), and generates new encrypted files, which your are free to share.\n- It's especially useful for encrypting sensitive data, such as secrets, that you need to gitignore or add to a remote host.\n- This allows you to securely share files while maintaining the confidentiality of sensitive information.\n\n---\n## Important Security Note\n\n**If you lose your custom key, you will lose access to your encrypted files.** This script is framework-independent and isolated.\n\nFor example, even if you set the Rails app's `master.key` as the `key` for this encryptor, if you generate a new `master.key` for your Rails app, it will not unlock your previously encrypted files, and you will lose them forever.\n\n---\n## INFO\n\n1. The Files: `.env.test`, `.env.development`, `config/master.key` are for demonstrational purposes only. You don't need to expose any of those files anywhere.\n2. The script uses `openssl` lib only, which is built-in. \n\n---\n## Usage\n\n\n1. Open [env_retriever.rb](env_retriever.rb) edit the line 64, add the files you need to encrypt.\n2. **Encrypt the `.env` file(s)**:\n    - Run the encryption script to encrypt the `.env` files.\n    - Add the original `.env` files to `.gitignore` or delete them to prevent them from being pushed to version control.\n    - Push the encrypted `.env.enc` files to GitHub instead.\n\n3. **Decrypt when needed** (optional):\n    - Decrypt the `.env.enc` files during the deployment or when needed by using the provided decryption method.\n    - Ideally you can delete the methods related to decryption.\n\n---\n## Integration\n\nYou can integrate the decryptor into your application depending on your preference:\n\n1. Add the decryptor script to your app's root directory via the terminal.\n      \n   - To encrypt:\n   ```bash\n   ruby -r './env_retriever.rb' -e 'EnvRetriever.encrypt_files'\n   ```\n   \n   - To decrypt:\n   ```bash\n   ruby -r './env_retriever.rb' -e 'EnvRetriever.decrypt_files'\n   ```\n\n2. Integrate it into your application’s core logic (e.g., `application.rb` in a Rails app), initializers, etc.\n   - Using import `require_relative`\n   - Just move the modules straight into file.\n\n---\n\n## Playground\n\n1. clone the repo\n2. ```bash\n   ruby -r './env_retriever.rb' -e 'EnvRetriever.encrypt_files'\n   ```\n3. ```bash\n   ruby -r './env_retriever.rb' -e 'EnvRetriever.decrypt_files'\n   ```\n4. Works? You're good to go.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-jean-andreasian%2Ffile-encryptor-for-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa-jean-andreasian%2Ffile-encryptor-for-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-jean-andreasian%2Ffile-encryptor-for-ruby/lists"}