{"id":19596885,"url":"https://github.com/emmansun/vault-gmsm-plugin","last_synced_at":"2025-04-27T16:31:28.875Z","repository":{"id":64299440,"uuid":"351684562","full_name":"emmansun/vault-gmsm-plugin","owner":"emmansun","description":"hashicorp vault gmsm plugin","archived":false,"fork":false,"pushed_at":"2024-12-19T03:08:01.000Z","size":474,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T01:11:18.274Z","etag":null,"topics":["hashicorp-vault","sm"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emmansun.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":"2021-03-26T06:29:33.000Z","updated_at":"2024-12-19T03:08:05.000Z","dependencies_parsed_at":"2023-02-10T08:30:33.571Z","dependency_job_id":"885789e7-b8fc-431a-ae32-53ece5fedeb5","html_url":"https://github.com/emmansun/vault-gmsm-plugin","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmansun%2Fvault-gmsm-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmansun%2Fvault-gmsm-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmansun%2Fvault-gmsm-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmansun%2Fvault-gmsm-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emmansun","download_url":"https://codeload.github.com/emmansun/vault-gmsm-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251171193,"owners_count":21547062,"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":["hashicorp-vault","sm"],"created_at":"2024-11-11T08:57:01.568Z","updated_at":"2025-04-27T16:31:28.555Z","avatar_url":"https://github.com/emmansun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vault plugin: GMSM\r\n\r\n[![Github CI](https://github.com/emmansun/vault-gmsm-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/emmansun/vault-gmsm-plugin/actions/workflows/ci.yml) \r\n[![Documentation](https://godoc.org/github.com/emmansun/vault-gmsm-plugin?status.svg)](https://godoc.org/github.com/emmansun/vault-gmsm-plugin) \r\n![GitHub go.mod Go version (branch)](https://img.shields.io/github/go-mod/go-version/emmansun/vault-gmsm-plugin)\r\n[![Release](https://img.shields.io/github/release/emmansun/vault-gmsm-plugin/all.svg)](https://github.com/emmansun/vault-gmsm-plugin/releases)\r\n\r\n1. **sm4_gcm96** is supported now, SM4-GCM with a 128-bit SM4 key and a 96-bit nonce; supports encryption, decryption, key derivation, and convergent encryption.\r\n2. **ecdsa-sm2** is also supported, this key type can be used for encryption/decryption, sign/verify.\r\n\r\n#### Run development mode on windows\r\n\r\n1. Build the plugin, open command window and go to vault-gmsm-plugin/scripts folder, run build.bat\r\n2. Copy vault-gmsm-plugin.exe to your vault plugin folder\r\n3. Start the vault `vault server -dev -dev-root-token-id=root -dev-plugin-dir=./plugins`\r\n4. Set environment variables: \r\n   - set VAULT_ADDR=http://127.0.0.1:8200 \r\n   - set VAULT_TOKEN=root\r\n5. Register the plugin `vault plugin register -sha256=0cc95756eda21c9f5d5a2aa272804a68eaa343ef5a6ad5463b3ed423f52eadcf secret vault-gmsm-plugin.exe`，这里的hash值来自plugin.sha256sum   \r\n6. Enable the plugin `vault secrets enable -path=gmsm vault-gmsm-plugin.exe`\r\n7. Create one test key `vault write -f gmsm/keys/mykey`\r\n8. Use the key to encrypt `vault write gmsm/encrypt/mykey plaintext=bXkgc2VjcmV0IGRhdGE=`\r\n9. Use the key to decrypt `vault write gmsm/decrypt/mykey ciphertext=vault:v1:UY653qxNcU5PZQT1QxRHHW7osP7B/jGMQgZZT2xvAnBb8yPoQuwwPrHH`\r\n10. Rotate, `vault write -f gmsm/keys/mykey/rotate`\r\n11. Rewrap, `vault write -f gmsm/rewrap/mykey ciphertext=vault:v1:UY653qxNcU5PZQT1QxRHHW7osP7B/jGMQgZZT2xvAnBb8yPoQuwwPrHH`\r\n\r\n![sm4 sample](./images/test.png)\r\n\r\n#### **ecdsa-sm2**\r\n\r\n- Create key: `vault write -f gmsm/keys/sm2-key type=ecdsa-sm2`  \r\n  `Success! Data written to: gmsm/keys/sm2-key`   \r\n- Encryption: ![](./images/image-20210329110630282.png)\r\n- Decryption: ![](./images/image-20210329110725901.png)\r\n- Read key:     ![](./images/image-20210329110813278.png)\r\n\r\n- Sign:           ![](./images/image-20210329134936146.png)\r\n\r\n- Verify:         ![](./images/image-20210329140556569.png)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmansun%2Fvault-gmsm-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmansun%2Fvault-gmsm-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmansun%2Fvault-gmsm-plugin/lists"}