This repository contains a simple Go-based Encryption-as-a-Service (EaaS) application using HashiCorp Vault's Transit Secrets Engine.
-
HashiCorp Vault:
- Install and configure HashiCorp Vault. Refer to the Vault Installation Guide for instructions.
-
Go:
- Install Go on your machine. Refer to the Official Go Documentation for installation instructions.
git clone https://github.com/RafMo20D/encryption-as-a-service-vault-demo.git
cd encryption-as-a-service-vault-demo
go get github.com/hashicorp/vault/api
. Enable the Transit Secrets Engine:
vault secrets enable transit
. Create a named encryption key (replace my-key with your desired key name):
vault write -f transit/keys/my-key
- Run the Application
go run main.go
The server will start and listen on http://localhost:8080.
- Endpoints . /encrypt: POST request with plaintext parameter. . /decrypt: POST request with ciphertext parameter.
curl -X POST -d "plaintext=HelloWorld" http://localhost:8080/encrypt
If you encounter permission issues, ensure that your Vault token has the necessary policies and permissions. Create a policy file and associate it with your token.
Contributions are welcome! Feel free to open issues, provide feedback, or submit pull requests.