crypto

command
v0.0.0-...-b7e3e27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

README

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
  1. 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
  1. 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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL