Querying Bucket Encryption

Last Updated At: 2025-10-21 09:10:00

Description

The GET Bucket encryption API is used to query the default encryption configuration for a specified bucket.

To execute this API, GetBucketEncryption permission is required. By default, the owner of the bucket has permission to use this API directly, and the bucket owner can also grant permission to other users.

Request

Request Example

GET /?encryption HTTP 1.1
Host: <BucketName-APPID>.<Endpoint>
Date: GMT Date
Authorization: Auth String

Note:

  • is the bucket name with APPID as the suffix, for example, examplebucket-1250000000.
  • Authorization: Auth String (For details, see Request Signature).

Request Parameters

This API has no request parameters.

Request Headers

This API only uses common request headers. For details, please refer to the Common Request Headers document.

Request Body

This API has no request body.

Response

Response Headers

This API only returns the public response header. For details, see Common Response Headers documentation.

Response Body

The SSE-COS-encrypted response body is as follows:

<ServerSideEncryptionConfiguration>
      <Rule>
            <ApplyServerSideEncryptionByDefault>
                <SSEAlgorithm>AES256|KMS</SSEAlgorithm>
                <KMSMasterKeyID>String</KMSMasterKeyID>
            </ApplyServerSideEncryptionByDefault>
      </Rule>
</ServerSideEncryptionConfiguration>

Specific elements are as follows:

Element Name Parent Node Description Type
ServerSideEncryptionConfiguration No Configuration parameters including default encryption Container
Rule ServerSideEncryptionConfiguration Default server-side encryption configuration rules Container
ApplyServerSideEncryptionByDefault ServerSideEncryptionConfiguration.Rule Default configuration information for server-side encryption Container
SSEAlgorithm ServerSideEncryptionConfiguration.Rule.ApplyServerSideEncryptionByDefault Supported enumeration values are AES256 and KMS. AES256 indicates that the SSE-COS mode is used and the encryption algorithm is AES256. KMS indicates the SSE-KMS mode. String
KMSMasterKeyID ServerSideEncryptionConfiguration.Rule.ApplyServerSideEncryptionByDefault CMK of the KMS when the value of SSEAlgorithm is KMS. If it is not specified, the CMK created by COS by default is used. For details, see SSE-KMS Encryption. String

Error Codes

This API follows unified error response and error codes. For details, please refer to the Error Codes document.

Practical Case

Request

GET /?encryption HTTP 1.1
Host: examplebucket-1250000000.cos.city.yfm4.fsphere.cn
Date: Mon, 17 Jun 2019 08:37:35 GMT
Authorization: signatureValue

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: xxxx
Date: Mon, 17 Jun 2019 08:37:36 GMT
x-cos-request-id: NWQwNzUxNTBfMzdiMDJhMDlfOWM0Nl85NDFk****

<?xml version = "1.0" encoding = "UTF-8">
<ServerSideEncryptionConfiguration>
      <Rule>
            <ApplyServerSideEncryptionByDefault>
                <SSEAlgorithm>AES256</SSEAlgorithm>
            </ApplyServerSideEncryptionByDefault>
      </Rule>
</ServerSideEncryptionConfiguration>