Skip to content

Commit b41bf84

Browse files
authored
docs(review): test and review of tuto
1 parent 11606c3 commit b41bf84

File tree

1 file changed

+61
-48
lines changed
  • tutorials/object-storage-sse-c-with-secret-manager

1 file changed

+61
-48
lines changed

tutorials/object-storage-sse-c-with-secret-manager/index.mdx

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,111 +2,124 @@
22
meta:
33
title: Using Secret Manager to store encryption key for SSE-C
44
description: Learn how to use Secret Manager to store encryption key for Object Storage and SSE-C.
5-
content:
6-
h1: Using Secret Manager to store encryption key for SSE-C
7-
paragraph: Learn how to use Secret Manager to store encryption key for Object Storage and SSE-C.
85
tags: object-storage secret-manager encryption
9-
categories:
6+
products:
107
- object-storage
118
- secret-manager
129
- key-manager
1310
dates:
1411
validation: 2025-10-15
1512
posted: 2025-10-15
13+
validation_frequency: 12
14+
difficulty: beginner
15+
usecase:
16+
- manage-share-and-store-data
17+
ecosystem:
18+
- scaleway-only
1619
---
1720
import Requirements from '@macros/iam/requirements.mdx'
1821

19-
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.
22+
This tutorial explains how to use Key Manager and Secret Manager to generate and store an encryption key for [SSE-C](/object-storage/api-cli/enable-sse-c/), used to encrypt and decrypt objects in your Scaleway Object Storage bucket.
2023

2124
<Requirements />
2225

2326
- A Scaleway account logged into the [console](https://console.scaleway.com)
2427
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
25-
- An [Object Storage bucket](/object-storage/how-to/create-a-bucket/)
28+
- [Created](/object-storage/how-to/create-a-bucket/) an Object Storage bucket
2629
- Installed and initialized the [AWS CLI](/object-storage/api-cli/object-storage-aws-cli/)
2730

28-
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.
31+
The goal of this tutorial is to:
2932

30-
## Generating the encryption key
33+
- Generate an encryption key using Key Manager
34+
- Store it securely in Secret Manager
35+
- Use it to encrypt your Object Storage objects with SSE-C
3136

32-
Run the following commands to create a key in Key Manager, generate the encryption key, then store it in Secret Manager.
37+
## Generating the encryption key
3338

34-
1. Create a key on the Key Manager
39+
1. Open a terminal and create a key in Key Manager:
3540

36-
```bash
37-
KEY_ID=$(scw keymanager key create -o template="{{.ID}}")
38-
```
41+
```bash
42+
KEY_ID=$(scw keymanager key create -o template="{{.ID}}")
43+
```
3944

40-
2. Generate the data encryption key
45+
2. Run the following command to generate a data encryption key:
4146

42-
```bash
43-
scw keymanager key generate-data-key "$KEY_ID" -o json | jq -r .plaintext | base64 -d > ssec.key
44-
```
47+
```bash
48+
scw keymanager key generate-data-key "$KEY_ID" -o json | jq -r .plaintext | base64 -d > ssec.key
49+
```
4550

46-
3. Create a secret in the Secret manager to store the data encryption key
51+
3. Create a secret in Secret manager to store the data encryption key:
4752

48-
```bash
49-
SECRET_ID=$(scw secret secret create name=ssec-key path=/keys -o template="{{.ID}}")
50-
```
53+
```bash
54+
SECRET_ID=$(scw secret secret create name=ssec-key path=/keys -o template="{{.ID}}")
55+
```
5156

52-
4. Store the data encryption key
57+
4. Store the data encryption key in Secret Manager:
5358

54-
```bash
55-
scw secret version create "$SECRET_ID" data="@ssec.key"
56-
```
59+
```bash
60+
scw secret version create "$SECRET_ID" data="@ssec.key"
61+
```
5762

5863
## Preparing the encryption key and its digest
5964

60-
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.
65+
You must now retrieve the encryption key from Secret Manager, encode it to base64, compute its MD5 digest, and store both values in environment variables.
6166

62-
1. Accessing the raw key
67+
1. Access the secret version to retrieve the raw key:
6368

64-
```bash
65-
scw secret version access "$SECRET_ID" revision=latest raw=true > ssec.key
66-
```
69+
```bash
70+
scw secret version access "$SECRET_ID" revision=latest raw=true > ssec.key
71+
```
6772

68-
2. Serialize it to base64
73+
2. Encode the key to base64:
6974

70-
```bash
71-
ENCRYPTION_KEY=$(cat ssec.key | base64)
72-
```
75+
```bash
76+
ENCRYPTION_KEY=$(cat ssec.key | base64)
77+
```
7378

74-
3. Compute the MD5 digest
79+
3. Compute the MD5 digest of the key:
7580

76-
```bash
77-
KEY_DIGEST=$(openssl dgst -md5 -binary ssec.key | base64)
78-
```
81+
```bash
82+
KEY_DIGEST=$(openssl dgst -md5 -binary ssec.key | base64)
83+
```
7984

8085
<Message type="important">
81-
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.
86+
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.
8287
</Message>
8388

84-
### Upload and download object with SSE-C
89+
### Upload and download objects with SSE-C
8590

86-
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.
91+
1. Upload an object of your choice to your bucket and encrypt it. Make sure that you replace:
92+
93+
- `<bucket-name>` with the name of your bucket
94+
- `<object-key>` with the desired name of the object in the bucket
95+
- `<path/to/your/file>` with the path to the file you want to upload
8796

8897
```bash
8998
aws s3api put-object \
90-
--bucket <your-bucket-name> \
91-
--key <your-object-key> \
99+
--bucket <bucket-name> \
100+
--key <object-key> \
92101
--body <path/to/your/file> \
93102
--sse-customer-algorithm AES256 \
94103
--sse-customer-key $ENCRYPTION_KEY \
95104
--sse-customer-key-md5 $KEY_DIGEST
96105
```
97106

98-
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.
107+
2. Download the previously uploaded object and decrypt it. Make sure that you replace:
108+
109+
- `<bucket-name>` with the name of your bucket
110+
- `<object-key>` with the name of your object in the bucket
111+
- `<path/to/your/file>` with the local path where you want to save the file
99112

100113
```bash
101114
aws s3api get-object \
102-
--bucket <your-bucket-name> \
103-
--key <your-object-key> \
115+
--bucket <bucket-name> \
116+
--key <object-key> \
104117
<path/to/destination/file> \
105118
--sse-customer-algorithm AES256 \
106119
--sse-customer-key $ENCRYPTION_KEY \
107120
--sse-customer-key-md5 $KEY_DIGEST
108121
```
109122

110-
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.
123+
You now know how to use Key Manager and Secret Manager to generate, store, and use an encryption key to protect your Object Storage data with SSE-C.
111124

112-
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.
125+
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.

0 commit comments

Comments
 (0)