You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scaleway's Key Manager provides a secure way to manage asymmetric keys, allowing you to offload sensitive cryptographic
10
-
operations to a managed service. In this guide, you'll learn how to integrate the Scaleway Go SDK to encrypt and decrypt
11
-
data using an rsa_oaep_3072_sha256 key directly through the Key Manager API.
14
+
Scaleway's Key Manager provides a secure way to manage asymmetric keys, allowing you to offload sensitive cryptographic operations to a managed service. This documentation page shows you how to integrate the Scaleway Go SDK to encrypt and decrypt data using an `rsa_oaep_3072_sha256` key directly through the [Key Manager API](https://www.scaleway.com/en/developers/api/key-manager/).
12
15
13
16
14
-
<Messagetype="warning">
15
-
Please note that we do not recommend using asymmetric encryption for anything other than key encryption.
16
-
For all other purposes (eg. encrypting large data or files), we recommend using Tink with Scaleway's Key Manager as explained [here.](/key-manager/api-cli/encrypt-decrypt-data-with-km-dek/)
17
+
<Messagetype="important">
18
+
We do not recommend using asymmetric encryption for anything other than key encryption.
19
+
For all other purposes (encrypting large data or files), we recommend using Tink with Scaleway's Key Manager as explained [in the dedicated documentation](/key-manager/api-cli/encrypt-decrypt-data-with-km-dek/).
17
20
</Message>
18
21
19
22
## Configuring your environment variables
@@ -30,16 +33,15 @@ Open a terminal and paste the following commands to export your environment vari
30
33
export SCW_API_URL="<api-URL>"
31
34
```
32
35
33
-
## Encrypt data
36
+
## Encrypting data
34
37
35
-
This operation takes place locally, ensuring the plaintext message never leaves your environment unprotected.
36
-
The public key can be fetched using the Key Manager API, parsed, and used to encrypt data with RSA-OAEP and SHA-256 padding.
38
+
This operation takes place locally, ensuring the plaintext message never leaves your environment unprotected. The public key can be fetched using the Key Manager API, parsed, and used to encrypt data with RSA-OAEP and SHA-256 padding.
37
39
38
40
```golang
39
-
// encryptAsymmetric encrypts data on your local machine using an 'rsa_oaep_3072_sha256' key retrieved from Scaleway KMS.
41
+
// encryptAsymmetric encrypts data on your local machine using an 'rsa_oaep_3072_sha256' key retrieved from Scaleway Key Manager.
40
42
//
41
43
// Parameters:
42
-
// - keyID: The unique identifier of the asymmetric key stored in Scaleway KMS.
44
+
// - keyID: The unique identifier of the asymmetric key stored in Key Manager.
43
45
// - message: The plaintext message that needs to be encrypted.
- Encryption can also be performed using the Scaleway's Key Manager Encrypt method.
89
-
- In the case of asymmetric encryption, the maximum payload size allowed depends on the key algo (190 bytes for `RSA_OAEP_2048_SHA256`, 318 bytes for `RSA_OAEP_3072_SHA256` and 446 bytes for `RSA_OAEP_4096_SHA256`).
89
+
- Encryption can also be performed using the [encrypt method of the Key Manager API](https://www.scaleway.com/en/developers/api/key-manager/#path-keys-encrypt-a-payload).
90
+
- For asymmetric encryption, the maximum payload size allowed depends on the key algorithm used:
91
+
- 190 bytes for `RSA_OAEP_2048_SHA256`
92
+
- 318 bytes for `RSA_OAEP_3072_SHA256` and
93
+
- 446 bytes for `RSA_OAEP_4096_SHA256`)
90
94
</Message>
91
95
92
-
## Decrypt data
96
+
## Decrypting data
93
97
94
-
To retrieve the original message, you must send the encrypted ciphertext to Scaleway Key Manager,
95
-
which uses the private portion of the asymmetric key to decrypt it. This ensures your private key remains secure within
98
+
To retrieve the original message, you must send the encrypted ciphertext to Scaleway Key Manager, which uses the private portion of the asymmetric key to decrypt it. This ensures your private key remains secure within
96
99
Scaleway’s infrastructure.
97
100
98
101
```golang
99
102
100
-
// decryptAsymmetric attempts to decrypt a given ciphertext using an 'rsa_oaep_3072_sha256' key from Scaleway KMS.
103
+
// decryptAsymmetric attempts to decrypt a given ciphertext using an 'rsa_oaep_3072_sha256' key from Key Manager.
101
104
//
102
105
// Parameters:
103
-
// - keyID: The unique identifier of the asymmetric key stored in Scaleway KMS.
106
+
// - keyID: The unique identifier of the asymmetric key stored in Key Manager.
104
107
// - ciphertext: The encrypted data that needs to be decrypted.
0 commit comments