Help Center/ Object Storage Service/ SDK Reference/ BrowserJS/ Bucket APIs/ Bucket Encryption/ Obtaining the Bucket Encryption Configuration
Updated on 2026-08-14 GMT+08:00

Obtaining the Bucket Encryption Configuration

Function

After you enable encryption for a bucket, the objects you upload to this bucket will be encrypted with the specified encryption method before they are stored in OBS. When you later download these encrypted objects, OBS decrypts them first and then returns them to you.

This API is used to obtain the encryption configuration of a bucket.

Restrictions

Method

ObsClient.getBucketEncryption(params)

Request Parameters

Table 1 List of request parameters

Parameter

Type

Mandatory (Yes/No)

Description

Bucket

string

Yes

Explanation:

Bucket name

Restrictions:

  • A bucket name must be unique across all accounts and regions.
  • A bucket name:
    • Must be 3 to 63 characters long and start with a digit or letter. Lowercase letters, digits, hyphens (-), and periods (.) are allowed.
    • Cannot be formatted as an IP address.
    • Cannot start or end with a hyphen (-) or period (.).
    • Cannot contain two consecutive periods (..), for example, my..bucket.
    • Cannot contain a period (.) and a hyphen (-) adjacent to each other, for example, my-.bucket or my.-bucket.
  • If you repeatedly create buckets with the same name in the same region, no error will be reported and the bucket properties comply with those set in the first creation request.

Default value:

None

Responses

Table 2 ICommonMsg

Parameter

Type

Description

Status

number

Explanation:

HTTP status code returned by the OBS server

Value range:

A status code is a group of digits indicating the status of a response. It ranges from 2xx (indicating successes) to 4xx or 5xx (indicating errors). For details, see Status Codes.

Code

string

Explanation:

Error code returned by the OBS server

Message

string

Explanation:

Error description returned by the OBS server

HostId

string

Explanation:

Request server ID returned by the OBS server

RequestId

string

Explanation:

Request ID returned by the OBS server

Id2

string

Explanation:

Request ID2 returned by the OBS server

Indicator

string

Explanation:

Error code details returned by the OBS server

Table 3 InterfaceResult

Parameter

Type

Description

Rule

object

Explanation:

Bucket encryption configuration rule. For details, see Table 2.

Table 4 Rule

Parameter

Type

Description

ApplyServerSideEncryptionByDefault

object

Explanation:

Default encryption configuration of the bucket. For details, see Table 3.

BucketKeyEnabled

string

Explanation:

Whether to enable the OBS bucket key feature

Value range:

  • true: The OBS bucket key feature is enabled.
  • false: The OBS bucket key feature is disabled.
Table 5 ApplyServerSideEncryptionByDefault

Parameter

Type

Description

SSEAlgorithm

string

Explanation:

Server-side encryption algorithm used for the default encryption configuration of a bucket

Value range:

  • kms: SSE-KMS encryption and the AES256 algorithm are used. To use the SM4 algorithm, you need to configure KMSDataEncryption.
  • AES256: SSE-OBS encryption and the AES256 algorithm are used.

KMSDataEncryption

string

Explanation:

Encryption algorithm used in SSE-KMS mode

KMSMasterKeyID

string

Explanation:

ID of the KMS master key used in SSE-KMS mode

ProjectID

string

Explanation:

ID of the project where the KMS master key belongs in SSE-KMS mode