Server-Side Encryption
You can use server-side encryption to encrypt data uploaded to OBS to improve storage security and compliance. With server-side encryption, the OBS server encrypts the objects uploaded from the client before storing them. When the objects are accessed, the OBS server decrypts the objects and then returns them to the client.
OBS supports three encryption methods: server-side encryption with KMS-managed keys (SSE-KMS), server-side encryption with OBS-managed keys (SSE-OBS), and server-side encryption with customer-provided keys (SSE-C).
Comparison Dimension |
SSE-KMS |
SSE-OBS |
SSE-C |
---|---|---|---|
Scenarios |
Scenarios that require high compliance and security. Keys are generated by third-party validated HSMs. Access to keys is controlled and all operations involving keys are traceable by logs. |
Scenarios that require basic encryption and batch processing. OBS does not need to interact with KMS. SSE-OBS features lower access latency and better performance than SSE-KMS |
Scenarios that users need to store and manage keys by themself |
Key management |
KMS generates and keeps keys, and OBS uses the keys to encrypt objects. |
OBS generates and keeps keys, and uses the keys to encrypt objects. |
A user generates and keeps keys, and OBS uses the keys to encrypt objects. |
Encryption algorithm |
AES-256 and SM4 |
AES-256 |
AES-256 |
Encryption scope |
Bucket level and object level |
Bucket level and object level |
Object level |
Details |
- You can refer to the regions that support SSE-KMS on the console If you want to use the SM4 encryption algorithm when enabling SSE-KMS, choose the CN North-Ulanqab1 region.
- SSE-OBS is available on the entire Huawei Cloud Chinese Mainland website.
- SSE-C is available in the regions where the SSE-C API is supported.
Bucket-level and Object-level Server-Side Encryption
The following table compares bucket-level and object-level server-side encryption.
Item |
Bucket-level Encryption |
Object-level Encryption |
---|---|---|
Scenarios |
You need to encrypt all objects when they are uploaded to a bucket. |
You need to encrypt only some objects or select an encryption method and key each time you upload an object. |
Encryption methods |
SSE-KMS and SSE-OBS |
SSE-KMS, SSE-OBS, and SSE-C |
Configuration |
You can change your encryption configuration at any time. |
You can configure encryption during object upload and the configuration cannot be changed after the upload. |
Impacts |
|
Constraints
- Only one encryption method can be used each time an object is uploaded. The encryption configuration of an uploaded object cannot be changed.
- To use SSE-KMS to encrypt a bucket or the objects in it, you must have kms:cmk:get, kms:cmk:list, kms:cmk:create, kms:dek:create, and kms:dek:crypto permissions granted by using IAM, so that you can upload objects to or download objects from this bucket.
- If server-side encryption is disabled for a bucket, the encrypted objects can only be accessed over HTTPS.
- A key in use cannot be deleted, or the object encrypted with this key cannot be downloaded.
SSE-KMS
During the encryption in Figure 1, SSE-KMS supports envelope encryption. Customer master keys hosted by KMS are not directly used to encrypt data. Instead, data keys derived from them are used to encrypt data in OBS. OBS stores the encrypted objects and data keys.
During the decryption in Figure 2, KMS decrypts the data keys, uses them to decrypt the objects, and returns the objects to users.
KMS uses Hardware Secure Modules (HSMs) to ensure key security, enabling users to easily create and manage encryption keys. Keys are not displayed in plaintext outside HSMs, which prevents key disclosure. All operations performed on keys are controlled and logged, and usage of all keys is recorded, meeting regulatory compliance requirements.
Resource |
API |
Header |
---|---|---|
Bucket |
|
|
The encryption configuration is in the body. For details, see Configuring Bucket Encryption. |
||
Object |
|
|
You can configure a bucket policy to limit the server-side encryption for a specific bucket to a specified method. For example, if you want people to use PUT to upload objects to bucket ExampleBucket and encrypt them with SSE-KMS, you can use the following bucket policy to deny any upload requests that do not contain the x-obs-server-side-encryption:"kms" header:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
{ "Statement": [ { "Sid": "DenyUnEncryptedObjectUploads", "Effect": "Deny", "Principal": "*", "Action": "PutObject", "Resource": "ExampleBucket/*", "Condition": { "StringNotEquals": { "x-obs-server-side-encryption": "kms" } } } ] } |
SSE-OBS
SSE-OBS uses a data key derived from the OBS root key to encrypt and decrypt data. APIs related to SSE-OBS encryption
Resource |
API |
Header |
---|---|---|
Bucket |
x-obs-server-side-encryption: Encryption method of a bucket |
|
The encryption configuration is in the body. For details, see Configuring Bucket Encryption. |
||
Object |
x-obs-server-side-encryption: Encryption method of a bucket |
|
You can configure a bucket policy to restrict the request headers for a specified bucket. For example, if you require that object upload requests do not contain header x-obs-server-side-encryption:"AES256", you can use the following bucket policy:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
{ "Statement": [ { "Sid": "DenyUnEncryptedObjectUploads", "Effect": "Deny", "Principal": "*", "Action": "PutObject", "Resource": "YourBucket/*", "Condition": { "StringNotEquals": { "x-obs-server-side-encryption": "AES256" } } } ] } |
SSE-C
With SSE-C, OBS uses the keys and MD5 values provided by customers for server-side encryption.
Resource |
API |
Header |
---|---|---|
Object level |
|
|
If the source part or object has been encrypted and their copy also requires encryption, use the following headers to decrypt the source:
|
||
Enabling and Configuring Server-Side Encryption for a Bucket
You can use OBS Console, APIs, or SDKs to configure Server-Side Encryption for a bucket.
Configuring Object-Level Server-Side Encryption
You can use OBS Console, APIs, or SDKs to encrypt objects to be uploaded.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot