方法:privatekeydecrypt
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
解封装封装的私钥,然后解密使用公钥加密的内容加密密钥。
HTTP 请求
POST https://KACLS_URL/privatekeydecrypt
将 KACLS_URL
替换为密钥访问控制列表服务 (KACLS) 网址。
路径参数
无。
请求正文
请求正文中包含结构如下的数据:
JSON 表示法 |
{
"authentication": string,
"authorization": string,
"algorithm": string,
"encrypted_data_encryption_key": string,
"rsa_oaep_label": string,
"reason": string,
"wrapped_private_key": string
}
|
字段 |
authentication |
string
由身份提供方 (IdP) 颁发的 JWT,用于声明用户身份。请参阅身份验证令牌。
|
authorization |
string
一个 JWT,用于断言用户有权为 resource_name 解封装密钥。请参阅授权令牌。
|
algorithm |
string
在信封加密中用于加密数据加密密钥 (DEK) 的算法。
|
encrypted_data_encryption_key |
string (UTF-8)
采用 Base64 编码的加密内容加密密钥,该密钥使用与私钥相关联的公钥进行加密。大小上限:1 KB。
|
rsa_oaep_label |
string
如果算法为 RSAES-OAEP,则为 Base64 编码的标签 L。如果算法不是 RSAES-OAEP,则忽略此字段。
|
reason |
string (UTF-8)
一个传递 JSON 字符串,用于提供有关操作的其他背景信息。提供的 JSON 应先经过清理,然后再显示。大小上限:1 KB。
|
wrapped_private_key |
string
采用 base64 编码的封装私钥。大小上限:8 KB。
私钥或封装的私钥的格式取决于密钥访问控制列表服务 (KACLS) 的实现。在客户端和 Gmail 端,此数据会被视为不透明的 blob。
|
响应正文
如果成功,此方法将返回一个 base64 数据加密密钥。
如果操作失败,则会返回结构化错误回复。
JSON 表示法 |
{
"data_encryption_key": string
}
|
字段 |
data_encryption_key |
string
base64 编码的数据加密密钥。
|
示例
此示例提供了 privatekeydecrypt
方法的请求和响应示例。
请求
POST https://mykacls.example.org/v1/privatekeydecrypt
{
"wrapped_private_key": "wHrlNOTI9mU6PBdqiq7EQA...",
"encrypted_data_encryption_key": "dGVzdCB3cmFwcGVkIGRlaw...",
"authorization": "eyJhbGciOi...",
"authentication": "eyJhbGciOi...",
"algorithm": "RSA/ECB/PKCS1Padding",
"reason": "decrypt"
}
响应
{
"data_encryption_key": "akRQtv3nr+jUhcFL6JmKzB+WzUxbkkMyW5kQsqGUAFc="
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-04。
[null,null,["最后更新时间 (UTC):2025-08-04。"],[[["\u003cp\u003eThis endpoint (\u003ccode\u003eprivatekeydecrypt\u003c/code\u003e) unwraps a wrapped private key and decrypts the data encryption key.\u003c/p\u003e\n"],["\u003cp\u003eThe request body requires authentication, authorization, algorithm, encrypted data encryption key, wrapped private key, and optionally, RSA OAEP label and reason.\u003c/p\u003e\n"],["\u003cp\u003eUpon successful execution, the endpoint returns the base64-encoded data encryption key.\u003c/p\u003e\n"],["\u003cp\u003eIf the operation fails, a structured error response will be returned.\u003c/p\u003e\n"],["\u003cp\u003eAn example request and response are provided for illustration.\u003c/p\u003e\n"]]],["The `privatekeydecrypt` method unwraps a provided private key and decrypts an encrypted data encryption key (DEK). A POST request is sent to the `BASE_URL/privatekeydecrypt` endpoint. The request body requires `authentication`, `authorization`, `algorithm`, `encrypted_data_encryption_key`, `rsa_oaep_label`(optional), `reason`, and `wrapped_private_key`. Upon success, the response body returns the decrypted base64-encoded `data_encryption_key`; otherwise, a structured error is returned.\n"],null,["# Method: privatekeydecrypt\n\nUnwraps a wrapped private key and then decrypts the content encryption key\nthat is encrypted to the public key.\n\n### HTTP request\n\n`POST https://`\u003cvar translate=\"no\"\u003eKACLS_URL\u003c/var\u003e`/privatekeydecrypt`\n\nReplace \u003cvar translate=\"no\"\u003eKACLS_URL\u003c/var\u003e with the Key Access Control List\nService (KACLS) URL.\n\n### Path parameters\n\nNone.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` { \"authentication\": string, \"authorization\": string, \"algorithm\": string, \"encrypted_data_encryption_key\": string, \"rsa_oaep_label\": string, \"reason\": string, \"wrapped_private_key\": string } ``` |\n\n| Fields ||\n|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `authentication` | `string` A JWT issued by the identity provider (IdP) asserting who the user is. See [authentication tokens](/workspace/cse/reference/authentication-tokens). |\n| `authorization` | `string` A JWT asserting that the user is allowed to unwrap a key for `resource_name`. See [authorization tokens](/workspace/cse/reference/authorization-tokens). |\n| `algorithm` | `string` The algorithm that was used to encrypt the Data Encryption Key (DEK) in envelope encryption. |\n| `encrypted_data_encryption_key` | `string (UTF-8)` Base64-encoded encrypted content encryption key, which is encrypted with the public key associated with the private key. Max size: 1 KB. |\n| `rsa_oaep_label` | `string` Base64-encoded label L, if the algorithm is RSAES-OAEP. If the algorithm is not RSAES-OAEP, this field is ignored. |\n| `reason` | `string (UTF-8)` A passthrough JSON string providing additional context about the operation. The JSON provided should be sanitized before being displayed. Max size: 1 KB. |\n| `wrapped_private_key` | `string` The base64-encoded wrapped private key. Max size: 8 KB. The format of the private key or the wrapped private key is up to the Key Access Control List Service (KACLS) implementation. On the client and on the Gmail side, this is treated as an opaque blob. |\n\n### Response body\n\nIf successful, this method returns a base64 data encryption key.\n\nIf the operation fails, a\n[structured error reply](/workspace/cse/reference/structured-errors)\nis returned.\n\n| JSON representation ||\n|-------------------------------------------|---|\n| ``` { \"data_encryption_key\": string } ``` |\n\n| Fields ||\n|-----------------------|------------------------------------------------|\n| `data_encryption_key` | `string` A base64-encoded data encryption key. |\n\n### Example\n\nThis example provides a sample request and response for the `privatekeydecrypt`\nmethod.\n\n#### Request\n\n POST https://mykacls.example.org/v1/privatekeydecrypt\n\n {\n \"wrapped_private_key\": \"wHrlNOTI9mU6PBdqiq7EQA...\",\n \"encrypted_data_encryption_key\": \"dGVzdCB3cmFwcGVkIGRlaw...\",\n \"authorization\": \"eyJhbGciOi...\",\n \"authentication\": \"eyJhbGciOi...\",\n \"algorithm\": \"RSA/ECB/PKCS1Padding\",\n \"reason\": \"decrypt\"\n }\n\n#### Response\n\n {\n \"data_encryption_key\": \"akRQtv3nr+jUhcFL6JmKzB+WzUxbkkMyW5kQsqGUAFc=\"\n }"]]