{"id":13781645,"url":"https://github.com/keisentraut/age-keygen-deterministic","last_synced_at":"2025-05-11T15:31:56.572Z","repository":{"id":150367178,"uuid":"457116682","full_name":"keisentraut/age-keygen-deterministic","owner":"keisentraut","description":"simple Rust CLI tool to derive an age private key from passphrase","archived":false,"fork":false,"pushed_at":"2024-02-11T13:32:34.000Z","size":14,"stargazers_count":27,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-17T16:43:08.970Z","etag":null,"topics":["age-encryption"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keisentraut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-02-08T21:54:21.000Z","updated_at":"2024-11-14T12:15:29.000Z","dependencies_parsed_at":"2024-08-03T18:12:35.890Z","dependency_job_id":null,"html_url":"https://github.com/keisentraut/age-keygen-deterministic","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keisentraut%2Fage-keygen-deterministic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keisentraut%2Fage-keygen-deterministic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keisentraut%2Fage-keygen-deterministic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keisentraut%2Fage-keygen-deterministic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keisentraut","download_url":"https://codeload.github.com/keisentraut/age-keygen-deterministic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253588576,"owners_count":21932280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["age-encryption"],"created_at":"2024-08-03T18:01:27.941Z","updated_at":"2025-05-11T15:31:56.320Z","avatar_url":"https://github.com/keisentraut.png","language":"Rust","funding_links":[],"categories":["Rust","Tools"],"sub_categories":[],"readme":"# age-keygen-deterministic\n\nThis is a very simple Rust CLI tool which deterministically derives a single (or multiple) [age encryption](https://github.com/FiloSottile/age) secret keys from a passphrase.\nI use this because I use age for long-term backup and want to be able to restore my backup files even if my house burns down and I lost all copies of the secret key - but still remember the passphrase.\n\n## Disclaimer\n\nI am not a professional cryptographer and have not done any review of the third-party dependencies.\nUse at your own risk.\n\n**The output of this utility should be piped directly into ```age-keygen -y``` and only the public key should be stored permanently.**\nIf you run this utility repeatedly inside scripts or pipe the secret key directly to ```age -i- -d ...```, then you are most likely doing something stupid and will leak your passphrase.\n\n## Compile\n\nThis utility is written in Rust.\nJust clone this repository and then run ```cargo build```.\n\n## Usage\n\n```\nUSAGE:\n    age-keygen-deterministic [OPTIONS]\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nOPTIONS:\n    -c, --count \u003ccount\u003e      optional number of secret keys which should be created [default: 1]\n    -o, --offset \u003coffset\u003e    optional u64 offset for index of keys [default: 0]\n```\n\nIf you only need a single age key, just use it without any command line arguments.\nIf you want to generate more than one secret key, then you can simply use the ```--count``` argument.\n\n## Example run\n\nIf you use the passphrase ```example-passphrase-do-not-use!``` and want to generate the deterministic secret keys #2, #3 and #4, then just run the commands below:\n\n```\n$ cargo build --release\n$ ./target/release/age-keygen-deterministic -c 3 -o 2\nEnter passphrase: \n# secret key 2 below\nAGE-SECRET-KEY-1RSWAHJR48AWPN6HHTVVGXN7X3X0YWWA7TM7H22T7TF35EZPPVHHQ7WYGRZ\n# secret key 3 below\nAGE-SECRET-KEY-144T9ZKX0HK6CMMGYEN6WPN82Q4K9LVR376NUJF33HKVAQ70TXMHSPV96MY\n# secret key 4 below\nAGE-SECRET-KEY-1FMPVFDE9WD8CSTNS4J3QRNQ5VRTFE8973FVJ2JANT56HEPZTKA4SQZZ84R\n```\n\nThe public key for any of those private keys can be obtained by piping the secret key to ```age-keygen -y```.\n\n```\n$ echo AGE-SECRET-KEY-1VZ3CREDN87LLHYDVS6FK36EZEVWNZGGFFSWZDN7DL0J04WG723MQCZUS9Q | age-keygen -y\nage1z568mysf7kulsml0rxt6vxp3h26hjmgcmdpz8x6dfh0zlazspquqqawzn4\n``` \n\n## Cryptography \n\nPlease note that you should specify at least 256 bits of entropy.\nThis program will accept a passphrase with only 16 characters but in general you should use longer ones.\n\nThe passphrase is stretched with Argon2id to a 64 byte master key.\nAfterwards, secret keys are generated by incrementing a u64 counter ```i``` and using ```HMAC_SHA256(master_key, i)``` for the age secret keys.\nEach 32 byte HMAC-SHA256 output is converted to Bech32 format and written to stdout.\n\nPlease note that there are some **cryptographic limitations** which this toy project does not care about:\n\n- This program does not attempt to clear any secrets from RAM before it exits. \n- This program does not make any guarantees about side-channel resistance.\n- No clamping of the X25519 key is done - but as far as I know, ```age-keygen``` doesn't do it either.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeisentraut%2Fage-keygen-deterministic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeisentraut%2Fage-keygen-deterministic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeisentraut%2Fage-keygen-deterministic/lists"}