mirror of https://github.com/dapr/go-sdk.git
* fix: add crypto validation example and fix mechanical markdown Signed-off-by: mikeee <hey@mike.ee> * fix: update test assertion and remove cleanup step Signed-off-by: mikeee <hey@mike.ee> --------- Signed-off-by: mikeee <hey@mike.ee> |
||
---|---|---|
.. | ||
components | ||
README.md | ||
desert.jpg | ||
main.go |
README.md
Dapr Crypto Example with go-sdk
Steps
Prepare
- Dapr installed
In order to run this sample, make sure that OpenSSL is available on your system.
Running
- This sample requires a private RSA key and a 256-bit symmetric (AES) key. We will generate them using OpenSSL:
mkdir -p keys
# Generate a private RSA key, 4096-bit keys
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out keys/rsa-private-key.pem
# Generate a 256-bit key for AES
openssl rand -out keys/symmetric-key-256 32
- Run the Go service app with Dapr:
dapr run --app-id crypto --resources-path ./components/ -- go run .
Cleanup
ctrl + c
to stop execution
dapr stop --app-id crypto
(lsof -i:8080 | grep crypto) | awk '{print $2}' | xargs kill
Result
== APP == Encrypted the message, got 856 bytes
== APP == Decrypted the message, got 24 bytes
== APP == The secret is "passw0rd"
== APP == Wrote encrypted data to encrypted.out
== APP == Wrote decrypted data to decrypted.out.jpg