Skip to content

Commit 74c0ce6

Browse files
authored
docs(fix): feedback (#5517)
1 parent 51de59a commit 74c0ce6

File tree

3 files changed

+53
-55
lines changed

3 files changed

+53
-55
lines changed

macros/key-manager/plaintext-vs-ciphertext.mdx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
macro: key-manager-plaintext-vs-ciphertext
33
---
44

5-
<Accordion>
6-
## What is the difference between ciphertext and plaintext?
7-
**Ciphertext** refers to data that has been encrypted using a cryptographic algorithm and a key.
8-
Ciphertext can be encrypted on the client side as long as the encryption key used for encryption is safely stored (in a Key Manager, for example).
9-
Unlike plaintext, ciphertext is not human-readable and cannot be understood or used without first decrypting it with the appropriate decryption key.
5+
<Message type="iam">
6+
### What is the difference between ciphertext and plaintext?
107

11-
**Plaintext** refers to unencrypted, readable data. In the context of key management, plaintext often refers to cryptographic keys or sensitive data that are stored or transmitted in an unencrypted form. This term is often used in contrast to ciphertext, which is data that has been encrypted and is not readable without decryption.
12-
</Accordion>
8+
[Ciphertext](/key-manager/concepts/#ciphertext) refers to data that has been encrypted using a cryptographic algorithm and a key.
139

10+
[Plaintext](/key-manager/concepts/#plaintext) refers to unencrypted, readable data.
11+
</Message>

pages/key-manager/api-cli/sign-verify-key-with-go-sdk.mdx

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Managing signatures using the Scaleway Go SDK and Key Manager
33
description: Learn how to create and validate signatures using Key Manager with the Scaleway Go SDK.
44
tags: key sensitive-data signature verification sign verify digest
55
dates:
6-
validation: 2025-05-27
6+
validation: 2025-09-15
77
posted: 2025-05-27
88
---
99

@@ -25,56 +25,56 @@ Open a terminal and paste the following commands to export your environment vari
2525

2626
## Creating a signature
2727

28-
```golang
29-
// signAsymmetric signs a plaintext message using a saved asymmetric private key 'ec_p256_sha256'
30-
// stored in Key Manager.
31-
//
32-
// Parameters:
33-
// - keyID: The unique identifier of the asymmetric key stored in Key Manager.
34-
// - message: The plaintext message that needs to be signed.
35-
//
36-
// Returns:
37-
// - err: An error if the signing process fails, otherwise nil.
38-
func signAsymmetric(keyID string, message string) error {
39-
// Initialize the Scaleway client
40-
client, err := scw.NewClient(scw.WithEnv())
41-
if err != nil {
42-
panic(err)
28+
```go
29+
// signAsymmetric signs a plaintext message using a saved asymmetric private key 'ec_p256_sha256'
30+
// stored in Key Manager.
31+
//
32+
// Parameters:
33+
// - keyID: The unique identifier of the asymmetric key stored in Key Manager.
34+
// - message: The plaintext message that needs to be signed.
35+
//
36+
// Returns:
37+
// - err: An error if the signing process fails, otherwise nil.
38+
func signAsymmetric(keyID string, message string) error {
39+
// Initialize the Scaleway client
40+
client, err := scw.NewClient(scw.WithEnv())
41+
if err != nil {
42+
panic(err)
43+
}
44+
kmsApi := key_manager.NewAPI(client)
45+
46+
// Convert the message into bytes. Cryptographic plaintexts and ciphertexts are always byte arrays.
47+
plaintext := []byte(message)
48+
49+
// Calculate the digest of the message.
50+
// Note: Digest algorithm must match the key algorithm.
51+
// - Use SHA-256 for most algorithms (e.g., RSA_OAEP_3072_SHA256, EC_P256_SHA256).
52+
// - Use SHA-384 **only** for ECC_P384_SHA384.
53+
digest := sha256.New()
54+
if _, err = digest.Write(plaintext); err != nil {
55+
return fmt.Errorf("failed to create digest: %w", err)
56+
}
57+
58+
// Build the signing request.
59+
req := &key_manager.SignRequest{
60+
Digest: digest.Sum(nil),
61+
KeyID: keyID,
62+
}
63+
64+
// Call the API
65+
response, err = kmsApi.Sign(req)
66+
if err != nil {
67+
return fmt.Errorf("failed to sign digest: %w", err)
68+
}
69+
70+
fmt.Printf("Signed digest: %s", response.Signature)
71+
return nil
4372
}
44-
kmsApi := key_manager.NewAPI(client)
45-
46-
// Convert the message into bytes. Cryptographic plaintexts and ciphertexts are always byte arrays.
47-
plaintext := []byte(message)
48-
49-
// Calculate the digest of the message.
50-
// Note: Digest algorithm must match the key algorithm.
51-
// - Use SHA-256 for most algorithms (e.g., RSA_OAEP_3072_SHA256, EC_P256_SHA256).
52-
// - Use SHA-384 **only** for ECC_P384_SHA384.
53-
digest := sha256.New()
54-
if _, err = digest.Write(plaintext); err != nil {
55-
return fmt.Errorf("failed to create digest: %w", err)
56-
}
57-
58-
// Build the signing request.
59-
req := &key_manager.SignRequest{
60-
Digest: digest.Sum(nil),
61-
KeyID: keyID,
62-
}
63-
64-
// Call the API
65-
response, err = kmsApi.Sign(req)
66-
if err != nil {
67-
return fmt.Errorf("failed to sign digest: %w", err)
68-
}
69-
70-
fmt.Printf("Signed digest: %s", response.Signature)
71-
return nil
72-
}
7373
```
7474

7575
## Validating the signature
7676

77-
```golang
77+
```go
7878
// verifyAsymmetricSignature verifies that an 'ec_p256_sha256' signature is valid for a given message.
7979
//
8080
// Parameters:

pages/key-manager/reference-content/cryptographic-details-key-manager.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Understanding Key Manager cryptography
33
description: This page describes the cryptographic mechanisms used by Scaleway Key Manager, in accordance with ANSSI-PA-079 recommendations.
44
tags: key-manager security
55
dates:
6-
validation: 2025-05-23
6+
validation: 2025-09-15
77
posted: 2025-05-23
88
---
99

@@ -53,7 +53,7 @@ To reduce the risk of key overuse, plaintext payloads are limited to a maximum s
5353
Scaleway provides Tink integrations for Go and Python, which is the preferred integration method.
5454

5555
- [Tink Python integration](https://github.com/scaleway/tink-py-scwkms)
56-
- [Ting Go integration](https://github.com/scaleway/tink-go-scwkms)
56+
- [Tink Go integration](https://github.com/scaleway/tink-go-scwkms)
5757
</Message>
5858

5959
### Asymmetric encryption

0 commit comments

Comments
 (0)