{"id":17918302,"url":"https://github.com/link-/aws_kms","last_synced_at":"2025-07-23T23:33:50.185Z","repository":{"id":148981409,"uuid":"257567132","full_name":"Link-/aws_kms","owner":"Link-","description":"A reference implementation of envelop encryption with KMS","archived":false,"fork":false,"pushed_at":"2020-04-21T11:06:10.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T12:03:50.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/Link-.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":"2020-04-21T11:01:06.000Z","updated_at":"2023-03-05T07:13:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"567ba2d1-6de2-4537-a8b4-62ea909b1b64","html_url":"https://github.com/Link-/aws_kms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Link-/aws_kms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link-%2Faws_kms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link-%2Faws_kms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link-%2Faws_kms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link-%2Faws_kms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Link-","download_url":"https://codeload.github.com/Link-/aws_kms/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Link-%2Faws_kms/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266768369,"owners_count":23981355,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":[],"created_at":"2024-10-28T20:10:40.833Z","updated_at":"2025-07-23T23:33:50.161Z","avatar_url":"https://github.com/Link-.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### ⚠️ This is a work in progress, this is not production ready.\n\n### Installation\n\n1. Make sure your `~/.aws/credentials` is populated with your account's access key and secrets. This POC will attempt \nto read the keys NOT in the default profile but a profile named `personal`\n2. Create a new CMK in KMS using the following configuration:\n    ```\n    Key Type: Asymmetric\n    Origin: AWS_KMS\n    Key Spec: RSA_4096\n    Key Usage: Encrypt and decrypt\n    Encryption algorithms: \n    RSAES_OAEP_SHA_1\n    RSAES_OAEP_SHA_256\n    ```\n3. Open the `KmsService.java` file and update the member variables to match your configuration\n    ```\n    private final static String cmkArn = \"arn:aws:kms:eu-west-1:XXX:key/XXX\";\n    private final static String cmkAlias = \"KEY_ALIAS\";\n    private final static Region region = Region.EU_WEST_1;\n    private final static String profileName = \"personal\";\n    ```\n4. Build: `mvn clean install`\n5. Run: `mvn spring-boot:run`\n\n### Usage\n\n##### Create a User:\n*Request:*\n```\ncurl --location --request POST 'localhost:8080/customer' \\\n    --header 'Content-Type: application/x-www-form-urlencoded' \\\n    --form 'customerId=1111111' \\\n    --form 'registrationCode=e54c7f888147b5596e721019bc023eb073e108a01b4d3589ce94c92282b0c17a'\n```\n\n*Example Response:*\n```\n{\n    \"id\": 1,\n    \"customerId\": \"1111111\",\n    \"encryptedRegistrationCode\": \"AAAADA5rOCQ3i0zw7t9/RiUUxmOOem3l/Lzpze8n9xZg2Y/aVMN43h05fJQSlSl7R0jIc5YBsltgsOaglVUFzMBaaNLmX94zOeNhUi5X+ol95hpV/yFcncGt3/G7fMCm\",\n    \"cmkAlias\": \"tw_poc_cmk\",\n    \"cmkId\": \"arn:aws:kms:eu-west-1:730880032795:key/95ae5ce4-862f-49eb-b103-05d06cd0b426\",\n    \"encryptionKey\": \"TKEsGWuv2Q3zb/NnlIlJq3NavKjpYQ09MHj7nny/Xvk+wovHXwOFaKBOQ0Ctkog8/ENVmF3CmzqRmMeiMqwGV5zGID58kn61nPtzeU4nc27XTj+mUxTq9VOCBZ4M+Op+BNUUOOmFa8sNhIk4z/QFFk+7aiU/PGZKcku3o9PrwDTHR9MMerujaBlhKury0rI0daan5wPQmUZw8cd8DoDMGYsdEa4D3raK8nPsadOiJbIEvNvhQGBuWaDCEcCwmR4u7cwVd+EgElRlquRvwP+HF4WLyXdtuNzVVfbWOZQorajoKPL63xv+HILiKkcHD2bo5hrZIpDHVnkfP9sWtrPH9SiB8710XWQJMg7FIGVgHe9M/1Fa+LyNTxzR6EJsWa+Z+vnY7JKsmRynRDup4liSX7OLRYinWOvgFppPxceNuR6DfxOl062FYgksIfbRbCnhAZuZ/EyxAmLx6XdQXIPhjm0dcwrvodPPO/XB95slRmEzzsi0WeNqqFnKvtt91vn6FnDLU4BV143EWKcXysdy0fFdWMbXxXNztUGIt4sMTEd0Xr88FNFY4ZpkjtCcPb1ZJi0+su4CzXSSaDg3Rw4G46oEtqHNzLn0EG2a00A2vrsM0sT5J1M8MkefsoX1qGPsy99RV4JiWMu8zh6FfNiVd97gxehqWATZi1P0qm4EeXw=\"\n}\n```\n\n##### Get a User:\n\n\n*Request:*\n```\ncurl --location --request GET 'localhost:8080/customer' \\\n--header 'Content-Type: application/x-www-form-urlencoded' \\\n--form 'customerId=1111111'\n```\n\n*Example Response:* \n```\n{\n    \"id\": null,\n    \"customerId\": \"1111111\",\n    \"encryptedRegistrationCode\": \"e54c7f888147b5596e721019bc023eb073e108a01b4d3589ce94c92282b0c17a\",\n    \"cmkAlias\": \"tw_poc_cmk\",\n    \"cmkId\": \"arn:aws:kms:eu-west-1:730880032795:key/95ae5ce4-862f-49eb-b103-05d06cd0b426\",\n    \"encryptionKey\": \"TKEsGWuv2Q3zb/NnlIlJq3NavKjpYQ09MHj7nny/Xvk+wovHXwOFaKBOQ0Ctkog8/ENVmF3CmzqRmMeiMqwGV5zGID58kn61nPtzeU4nc27XTj+mUxTq9VOCBZ4M+Op+BNUUOOmFa8sNhIk4z/QFFk+7aiU/PGZKcku3o9PrwDTHR9MMerujaBlhKury0rI0daan5wPQmUZw8cd8DoDMGYsdEa4D3raK8nPsadOiJbIEvNvhQGBuWaDCEcCwmR4u7cwVd+EgElRlquRvwP+HF4WLyXdtuNzVVfbWOZQorajoKPL63xv+HILiKkcHD2bo5hrZIpDHVnkfP9sWtrPH9SiB8710XWQJMg7FIGVgHe9M/1Fa+LyNTxzR6EJsWa+Z+vnY7JKsmRynRDup4liSX7OLRYinWOvgFppPxceNuR6DfxOl062FYgksIfbRbCnhAZuZ/EyxAmLx6XdQXIPhjm0dcwrvodPPO/XB95slRmEzzsi0WeNqqFnKvtt91vn6FnDLU4BV143EWKcXysdy0fFdWMbXxXNztUGIt4sMTEd0Xr88FNFY4ZpkjtCcPb1ZJi0+su4CzXSSaDg3Rw4G46oEtqHNzLn0EG2a00A2vrsM0sT5J1M8MkefsoX1qGPsy99RV4JiWMu8zh6FfNiVd97gxehqWATZi1P0qm4EeXw=\"\n}\n```\n\n#### References\n1. https://aws.amazon.com/kms/faqs/\n2. http://jamesabrannan.com/2019/06/14/aws-key-management-system-kms-to-encrypt-and-decrypt-using-the-asw-java-2-sdk/\n3. https://proandroiddev.com/security-best-practices-symmetric-encryption-with-aes-in-java-7616beaaade9\n4. http://www.crypto-it.net/eng/theory/modes-of-block-ciphers.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flink-%2Faws_kms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flink-%2Faws_kms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flink-%2Faws_kms/lists"}