-
Couldn't load subscription status.
- Fork 252
feat(tutorial): add tutorial to store sse-c key into secret manager #5677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luxifer
wants to merge
5
commits into
scaleway:main
Choose a base branch
from
luxifer:int-secret-manager-sse-c
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+112
−0
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
188a8b7
feat(tutorial): add tutorial to store sse-c key into secret manager
luxifer f424f9a
fix(tutorial): change command in sse-c tutorial
luxifer e7a10d0
fix(tutorial): doc review 1
SamyOubouaziz 0d3fae7
fix(tutorial): doc review 2
SamyOubouaziz 11606c3
docs: split commands in ordered list with dedicated comments
luxifer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
tutorials/object-storage-sse-c-with-secret-manager/index.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| --- | ||
| meta: | ||
| title: Using Secret Manager to store encryption key for SSE-C | ||
| description: Learn how to use Secret Manager to store encryption key for Object Storage and SSE-C. | ||
| content: | ||
| h1: Using Secret Manager to store encryption key for SSE-C | ||
| paragraph: Learn how to use Secret Manager to store encryption key for Object Storage and SSE-C. | ||
| tags: object-storage secret-manager encryption | ||
| categories: | ||
| - object-storage | ||
| - secret-manager | ||
| - key-manager | ||
| dates: | ||
| validation: 2025-10-15 | ||
| posted: 2025-10-15 | ||
| --- | ||
| import Requirements from '@macros/iam/requirements.mdx' | ||
|
|
||
| In this tutorial you will learn how to use Key Manager and Secret Manager to generate and store an encryption key used with [SSE-C](/object-storage/api-cli/enable-sse-c/) to encrypt and decrypt objects stored in a Scaleway Object Storage bucket. | ||
|
|
||
| <Requirements /> | ||
|
|
||
| - A Scaleway account logged into the [console](https://console.scaleway.com) | ||
| - [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization | ||
| - An [Object Storage bucket](/object-storage/how-to/create-a-bucket/) | ||
| - Installed and initialized the [AWS CLI](/object-storage/api-cli/object-storage-aws-cli/) | ||
|
|
||
| The goal here is to use Key Manager to generate the encryption key, store the encryption key in Secret Manager, then use it to encrypt Object Storage objects SSE-C. | ||
|
|
||
| ## Generating the encryption key | ||
|
|
||
| Run the following commands to create a key in Key Manager, generate the encryption key, then store it in Secret Manager. | ||
|
|
||
| ```bash | ||
| KEY_ID=$(scw keymanager key create -o template="{{.ID}}") | ||
luxifer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| scw keymanager key generate-data-key "$KEY_ID" -o json | jq -r .plaintext | base64 -d > ssec.key | ||
| SECRET_ID=$(scw secret secret create name=ssec-key path=/keys -o template="{{.ID}}") | ||
| scw secret version create "$SECRET_ID" data="@ssec.key" | ||
| ``` | ||
|
|
||
| ## Preparing the encryption key and its digest | ||
|
|
||
| Run the following command to access the secret version to get the encryption key, encode it to base64, calculate the MD5 digest of the key (also encoded in base64), and store the outputs in environment variables. | ||
|
|
||
| ```bash | ||
| scw secret version access "$SECRET_ID" revision=latest raw=true > ssec.key | ||
| ENCRYPTION_KEY=$(cat ssec.key | base64) | ||
| KEY_DIGEST=$(openssl dgst -md5 -binary ssec.key | base64) | ||
| ``` | ||
|
|
||
| <Message type="important"> | ||
| If you delete the secret containing the encryption key, you also lose the data encrypted with it, as you will not be able to perform `GET` operations on encrypted objects without the corresponding key. | ||
| </Message> | ||
|
|
||
| ### Upload and download object with SSE-C | ||
|
|
||
| 1. Run the command below to upload an object and encrypt it. Make sure to replace `<your-bucket-name>`, `<your-object-key>`, and `<path/to/your/file>` with the correct values. | ||
|
|
||
| ```bash | ||
| aws s3api put-object \ | ||
| --bucket <your-bucket-name> \ | ||
| --key <your-object-key> \ | ||
| --body <path/to/your/file> \ | ||
| --sse-customer-algorithm AES256 \ | ||
| --sse-customer-key $ENCRYPTION_KEY \ | ||
| --sse-customer-key-md5 $KEY_DIGEST | ||
| ``` | ||
|
|
||
| 2. Run the command below to download the previously uploaded object and decrypt it. Make sure to replace `<your-bucket-name>`, `<your-object-key>`, and `<path/to/destination/file>` with the correct values. | ||
|
|
||
| ```bash | ||
| aws s3api get-object \ | ||
| --bucket <your-bucket-name> \ | ||
| --key <your-object-key> \ | ||
| <path/to/destination/file> \ | ||
| --sse-customer-algorithm AES256 \ | ||
| --sse-customer-key $ENCRYPTION_KEY \ | ||
| --sse-customer-key-md5 $KEY_DIGEST | ||
| ``` | ||
|
|
||
| You can now use Key Manager and Secret Manager to safely create and store an encryption key to secure your Object Storage deployment with SSE-C. | ||
|
|
||
| Refer to the [dedicated documentation](/object-storage/api-cli/enable-sse-c/) for more information on how to use SSE-C for Scaleway Object Storage. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.