方法:包裝
傳回已加密的資料加密金鑰 (DEK) 和相關資料。
詳情請參閱加密與解密資料。
HTTP 要求
POST https://KACLS_URL/wrap
將 KACLS_URL
替換為金鑰存取控制清單
服務 (KACLS)
網址。
路徑參數
無。
要求主體
要求主體的資料會採用以下結構:
JSON 表示法 |
{
"authentication": string,
"authorization": string,
"key": string,
"reason": string
}
|
欄位 |
authentication |
string
由 IdP 核發的使用者核發的 JWT。請參閱驗證權杖。
|
authorization |
string
JWT 宣告允許使用者包裝 resource_name 的金鑰。查看授權權杖。
|
key |
string
Base64 編碼的 DEK。大小上限:128 個位元組。
|
reason |
string (UTF-8)
直通式 JSON 字串,提供作業的其他背景資訊。提供的 JSON 必須先經過處理,才會顯示。大小上限:1 KB。
|
回應主體
如果成功的話,這個方法會傳回不透明的二進位物件。這個物件即將儲存
透過加密物件的方式傳送,並在後續
金鑰解除包裝作業。
如果作業失敗,
結構化錯誤回覆
。
二進位物件應包含加密 DEK 的唯一副本。
可以儲存實作專屬資料。
請勿將 DEK 儲存在金鑰存取控制清單服務 (KACLS) 系統中
而是將其加密,然後傳回包裝在 wrap_key 物件中。這麼做可以避免
文件及其金鑰之間的生命週期差異。舉例來說
使用者要求時,他們的資料會遭到徹底清除,或確保
從備份還原的先前版本可以解密。
JSON 表示法 |
{
"wrapped_key": string
}
|
欄位 |
wrapped_key |
string
Base64 編碼的二進位物件。大小上限:1 KB。
|
範例
這個範例提供了 wrap
方法的要求和回應範例。
要求
POST https://mykacls.example.com/v1/wrap
{
"key":"wHrlNOTI9mU6PBdqiq7EQA==",
"authorization": "eyJhbGciOi…"
"authentication": "eyJhbGciOi…"
"reason": "{client:'drive' op:'update'}"
}
回應
{
"wrapped_key": "3qTh6Mp+svPwYPlnZMyuj8WHTrM59wl/UI50jo61Qt/QubZ9tfsUc1sD62xdg3zgxC9quV4r+y7AkbfIDhbmxGqP64pWbZgFzOkP0JcSn+1xm/CB2E5IknKsAbwbYREGpiHM3nzZu+eLnvlfbzvTnJuJwBpLoPYQcnPvcgm+5gU1j1BjUaNKS/uDn7VbVm7hjbKA3wkniORC2TU2MiHElutnfrEVZ8wQfrCEpuWkOXs98H8QxUK4pBM2ea1xxGj7vREAZZg1x/Ci/E77gHxymnZ/ekhUIih6Pwu75jf+dvKcMnpmdLpwAVlE1G4dNginhFVyV/199llf9jmHasQQuaMFzQ9UMWGjA1Hg2KsaD9e3EL74A5fLkKc2EEmBD5v/aP+1RRZ3ISbTOXvxqYIFCdSFSCfPbUhkc9I2nHS0obEH7Q7KiuagoDqV0cTNXWfCGJ1DtIlGQ9IA6mPDAjX8Lg=="
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-22 (世界標準時間)。
[null,null,["上次更新時間:2024-08-22 (世界標準時間)。"],[[["Returns an encrypted Data Encryption Key (DEK) along with associated data for secure storage and later retrieval."],["The request body requires authentication, authorization, the base64-encoded DEK, and an optional reason for the operation."],["The response provides a wrapped key containing the encrypted DEK, which should be stored securely by the application."],["The KACLS system itself does not store the DEK, ensuring data security and preventing lifetime discrepancies."],["Refer to the provided links for detailed information on encrypting and decrypting data, authentication tokens, and authorization tokens."]]],["The `wrap` method encrypts a Data Encryption Key (DEK) and returns it as a base64-encoded binary object (`wrapped_key`). The request includes authentication and authorization JWTs, the base64-encoded DEK (`key`), and a JSON string (`reason`) for context. The response contains only the `wrapped_key`. The service should not store the DEK; the returned object is the only copy of the encrypted DEK. Deletion requests for the objects are not sent to the KACLS.\n"]]