生成数据密钥
下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。
参数 | 类型 | 是否必填 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | GenerateDataKey | 要执行的操作,取值:GenerateDataKey。 |
Version | String | 是 | 2021-02-18 | API的版本,取值:2021-02-18。 |
KeyringName | String | 否 | keyring-test | 密钥环名称,长度为 2 - 31 个字符。合法字符:[a-zA-Z0-9-_] |
KeyName | String | 否 | key-test | 主密钥名称,长度为 2 - 31 个字符。合法字符:[a-zA-Z0-9-_] |
KeyID | String | 否 | 0324d9b3-c5d9-4b6f-94e7-884010a16fee | 主密钥ID,二选一: |
EncryptionContext | String | 否 | {"user":"alice","path":"path/to/alice/plaintext.txt"} | key/value的JSON字符串。如果指定了该参数,则在调用Decrypt时需要提供同样的参数。 |
NumberOfBytes | Integer | 否 | 32 | 生成数据密钥的长度,取值:[1, 1024] |
下表仅列出本接口特有的返回参数。更多信息请参见返回结构。
参数 | 类型 | 示例值 | 描述 |
---|---|---|---|
Plaintext | String | kFw2RqALpWkHzLBNY8Q6x2F0viIebT4uIPkUOpCiitxZcA9ADwCoVVXLdfe3jJA997rWGYa7b6ifbjK06NSVpV9Nf5PnqHQvLy8cJkP0YHBp2dMhRtSP6JVDyShKhQN8yJyYMaKaD3URH7o8Xv1QltKHjpr18+w9ZrxWu1i54y2+2bRzUO9oPZt4breNSBN7mLqCutfL3EQuwKH0Zb0wpRdcKSwMpVbrnGGjV/hFxblAhmeJe4e32IUQKj0vVbTV1s2hY3jYguZ49Hl4JjVDbqqnM/nU79nHubQ/MoD5vFKe/sLX+sGgkGbx0SOa1wqQvk0FBNgkInNTzXGoyEWGd4OE8+cBaPmOxjRCsL51ckTHKkqGLIXZAigIH3B1A/BM5B51yjxS4xuyx0kk9vLQvYWCAY7g5N9DN5Rz10OdgX4ziyr80WufXziSvjdYf46Q+m3kzdeyknHP/JFpBP3E85FUxtrIARR4IAruHt6FwPEMIAs1NKCkEfDvGhEBds4CwbHSKJM916TBTLUwMZMJGSAMJgGVKLbh3VV8hVZWsK1+e6D7Vi/DvBYOjWovjTZ6UJH6nrBhXkcptWXO0y1mhG37sijm2w8B0PvqHyHYVXSP0mYMX2709awZ5MInO0X35nZi4iuwlxHcoFQbAXAKlpCMMfItYyOPrejRqdhcBb4= | 数据密钥明文,Base64编码 |
CiphertextBlob | String | 43y7grE9TjamX4P7ZOHFbwAAfdbxOzMLcyZqlPRh9rMVL2exoGbn53zKUTyt0jZD+Q5YWTmQf/z0Dm6WS+JvSKB3qchbUDVTZPrhUA0amFtBks6+s/rFXtUeBA4iirycN9j0/+BBmHVqAKiPFGJ4/83LdFA2MgoAMdcUaM6nhMZ7XCMaTvAH//Okx0bLJ2dqKf1R9DSFbcQtyYQBaJBfXMzM0cN5wya9M1KlXZZqqDGJQwLCf1ecuP3590dS1uvTJ9XQLlJUQWI/pLG2RxqKh00DlQf5E0+riLol5ocsMeDLefgc3w6pQ6lIOR4JsBsJZH1867r62x+dh8nAEY0AtOuVo8jjtS62QBoFtbI7WSekZUBVr2yao4817+xOC+oUF7JlZxuzPheFUsxkaiXvNxt08QiSZkX9qcjod5IaL4WqouffBf8XsWsoEqJlEW5hHnEJUzSzwrnpx/pz2km5rTvSMeczoLOM3Yo1o3oCv18Xg5FW2/SRHrBi6hjyGdMPhIwiMUENiBhgC4RFEqSWKdLTY2kgT0EO6H44X7piuz3qVyuiDlcM/thDrpJObNSEeaDkWgtPVacmoJ3Qh6xrCS4NyM8nOhp3lTYuOP1lGLn8Xlc14Kn95+qtdP3vQgyz9s4mMvuOzDa085QJxCZjpB/D1cIowf/hISKUioZwDtjLcnYAShV4p3LjW3JO5QC/wipdaug7x+RwjcWGIA4zLt54fIukKCcfI8QwwuHg7rwUPW1fpXiGuDKKWBt7egzJ2/4RU9wKiHiLSnsbNxw= | 数据密钥密文,Base64编码 |
GET /?Action=GenerateDataKey&Version=2021-02-18&KeyringName=demo&KeyName=demo HTTP/1.1 Host: kms.volcengineapi.com X-Date: 20240708T050838Z Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20240708/cn-beijing/kms/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f
{ "ResponseMetadata": { "RequestId": "202407081310481390470331439FAD82", "Action": "GenerateDataKey", "Version": "2021-02-18", "Service": "kms", "Region": "cn-beijing" }, "Result": { "Plaintext": "kFw2RqALpWkHzLBNY8Q6x2F0viIebT4uIPkUOpCiitxZcA9ADwCoVVXLdfe3jJA997rWGYa7b6ifbjK06NSVpV9Nf5PnqHQvLy8cJkP0YHBp2dMhRtSP6JVDyShKhQN8yJyYMaKaD3URH7o8Xv1QltKHjpr18+w9ZrxWu1i54y2+2bRzUO9oPZt4breNSBN7mLqCutfL3EQuwKH0Zb0wpRdcKSwMpVbrnGGjV/hFxblAhmeJe4e32IUQKj0vVbTV1s2hY3jYguZ49Hl4JjVDbqqnM/nU79nHubQ/MoD5vFKe/sLX+sGgkGbx0SOa1wqQvk0FBNgkInNTzXGoyEWGd4OE8+cBaPmOxjRCsL51ckTHKkqGLIXZAigIH3B1A/BM5B51yjxS4xuyx0kk9vLQvYWCAY7g5N9DN5Rz10OdgX4ziyr80WufXziSvjdYf46Q+m3kzdeyknHP/JFpBP3E85FUxtrIARR4IAruHt6FwPEMIAs1NKCkEfDvGhEBds4CwbHSKJM916TBTLUwMZMJGSAMJgGVKLbh3VV8hVZWsK1+e6D7Vi/DvBYOjWovjTZ6UJH6nrBhXkcptWXO0y1mhG37sijm2w8B0PvqHyHYVXSP0mYMX2709awZ5MInO0X35nZi4iuwlxHcoFQbAXAKlpCMMfItYyOPrejRqdhcBb4=", "CiphertextBlob": "43y7grE9TjamX4P7ZOHFbwAAfdbxOzMLcyZqlPRh9rMVL2exoGbn53zKUTyt0jZD+Q5YWTmQf/z0Dm6WS+JvSKB3qchbUDVTZPrhUA0amFtBks6+s/rFXtUeBA4iirycN9j0/+BBmHVqAKiPFGJ4/83LdFA2MgoAMdcUaM6nhMZ7XCMaTvAH//Okx0bLJ2dqKf1R9DSFbcQtyYQBaJBfXMzM0cN5wya9M1KlXZZqqDGJQwLCf1ecuP3590dS1uvTJ9XQLlJUQWI/pLG2RxqKh00DlQf5E0+riLol5ocsMeDLefgc3w6pQ6lIOR4JsBsJZH1867r62x+dh8nAEY0AtOuVo8jjtS62QBoFtbI7WSekZUBVr2yao4817+xOC+oUF7JlZxuzPheFUsxkaiXvNxt08QiSZkX9qcjod5IaL4WqouffBf8XsWsoEqJlEW5hHnEJUzSzwrnpx/pz2km5rTvSMeczoLOM3Yo1o3oCv18Xg5FW2/SRHrBi6hjyGdMPhIwiMUENiBhgC4RFEqSWKdLTY2kgT0EO6H44X7piuz3qVyuiDlcM/thDrpJObNSEeaDkWgtPVacmoJ3Qh6xrCS4NyM8nOhp3lTYuOP1lGLn8Xlc14Kn95+qtdP3vQgyz9s4mMvuOzDa085QJxCZjpB/D1cIowf/hISKUioZwDtjLcnYAShV4p3LjW3JO5QC/wipdaug7x+RwjcWGIA4zLt54fIukKCcfI8QwwuHg7rwUPW1fpXiGuDKKWBt7egzJ2/4RU9wKiHiLSnsbNxw=" } }
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。
状态码 | 错误码 | 说明 |
---|---|---|
400 | InvalidParameter | |
400 | InvalidKeyStatus | |
400 | MissingParameter | |
403 | KeyMaterialExpire | |
403 | Reject.Throttling.CMK | |
404 | Not Found | |
500 | UndefinedError |