วิธีการ: รวมใหม่
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
วิธีนี้จะช่วยให้คุณย้ายข้อมูลจากบริการรายการควบคุมการเข้าถึงคีย์เดิม
(KACLS1) ไปยัง KACLS ที่ใหม่กว่า (KACLS2) ต้องใช้คีย์การเข้ารหัสข้อมูล (DEK)
รวมด้วย wrap
API ของ KACLS1 และแสดงผล
DEK รวมด้วย API ของ wrap
ของ KACLS2
คำขอ HTTP
POST https://KACLS_URL/rewrap
แทนที่ KACLS_URL
ด้วยรายการควบคุมการเข้าถึงคีย์
URL ของบริการ (KACLS)
พารามิเตอร์เส้นทาง
ไม่มี
เนื้อหาของคำขอ
เนื้อหาของคำขอมีข้อมูลที่มีโครงสร้างต่อไปนี้
การแสดง JSON |
{
"authorization": string,
"original_kacls_url": string,
"reason": string,
"wrapped_key": string
}
|
ช่อง |
authorization |
string
JWT ยืนยันว่าผู้ใช้ได้รับอนุญาตให้แยกคีย์สำหรับ resource_name ดูโทเค็นการให้สิทธิ์
|
original_kacls_url |
string
URL ของ KACLS ของ Wrapper_key ปัจจุบัน
|
reason |
string (UTF-8)
สตริง JSON แบบส่งผ่านที่ให้บริบทเพิ่มเติมเกี่ยวกับการดำเนินการ JSON ที่ให้ไว้ควรทำความสะอาดก่อนแสดง ขนาดสูงสุด: 1 KB
|
wrapped_key |
string
ออบเจ็กต์ไบนารี Base64 ที่แสดงผลโดย wrap
|
เนื้อหาการตอบกลับ
หากทำสำเร็จ เมธอดนี้จะแสดงออบเจ็กต์ไบนารีแบบทึบแสงที่จะจัดเก็บ
Google Workspace พร้อมกับออบเจ็กต์ที่เข้ารหัส และส่งตามที่เป็นในครั้งต่อๆ ไป
การแยกคีย์ โดยควรแสดงผลรหัส base64 แบบเข้ารหัสด้วย
resource_key_hash
หากการดำเนินการล้มเหลว
การตอบกลับข้อผิดพลาดที่มีโครงสร้าง
ออบเจ็กต์ไบนารีควรมีสำเนาเดียวของ DEK ที่เข้ารหัส
สามารถจัดเก็บข้อมูลเฉพาะเกี่ยวกับการใช้งานได้
ไม่ต้องจัดเก็บ DEK ไว้ในระบบ KACLS แต่ให้เข้ารหัสแทนแล้วส่งคืนใน
ออบเจ็กต์ wrapped_key
ซึ่งจะช่วยป้องกันความคลาดเคลื่อนตลอดอายุการใช้งานระหว่าง
เอกสารและคีย์ เช่น เพื่อให้มั่นใจว่าข้อมูลของผู้ใช้จะครบถ้วนสมบูรณ์
ล้างข้อมูลเมื่อผู้ใช้ขอ หรือเพื่อให้เวอร์ชันก่อนหน้าได้รับการกู้คืน
จากข้อมูลสำรองจะสามารถถอดรหัสได้
Google จะไม่ส่งคำขอการลบไปยัง KACLS เมื่อออบเจ็กต์ถูกลบ
การแสดง JSON |
{
"resource_key_hash": string,
"wrapped_key": string
}
|
ช่อง |
resource_key_hash |
string
ออบเจ็กต์ไบนารีที่เข้ารหัสฐาน 64 โปรดดู
แฮชคีย์แหล่งข้อมูล
|
wrapped_key |
string
ออบเจ็กต์ไบนารีที่เข้ารหัสแบบ Base64 ขนาดสูงสุด: 1 KB
|
ตัวอย่าง
ตัวอย่างนี้แสดงคำขอและการตอบกลับตัวอย่างสำหรับเมธอด rewrap
ส่งคำขอ
POST https://mykacls.example.com/v1/rewrap
{
"wrapped_key": "7qTh6Mp+svVwYPlnZMyuj8WHTrM59wl/UI50jo61Qt/QubZ9tfsUc1sD62xdg3zgxC9quV4r+y7AkbfIDhbmxGqP64pWbZgFzOkP0JcSn+1xm/CB2E5IknKsAbwbYREGpiHM3nzZu+eLnvlfbzvTnJuJwBpLoPYQcnPvcgm+5gU1j1BjUaNKS/uDn7VbVm7hjbKA3wkniORC2TU2MiHElutnfrEVZ8wQfrCEpuWkOXs98H8QxUK4pBM2ea1xxGj7vREAZZg1x/Ci/E77gHxymnZ/ekhUIih6Pwu75jf+dvKcMnpmdLpwAVlE1G4dNginhFVyV/199llf9jmHasQQuaMFzQ9UMWGjA1Hg2KsaD9e3EL74A5fLkKc2EEmBD5v/aP+1RRZ3ISbTOXvxqYIFCdSFSCfPbUhkc9I2nHS0obEH7Q7KiuagoDqV0cTNXWfCGJ1DtIlGQ9IA6mPDAjX8Lg==",
"authorization": "eyJhbGciOi...",
"original_kacls_url": "https://original.example.com/kacls/v1",
"reason": "{client:'drive' op:'read'}"
}
คำตอบ
{
"wrapped_key": "3qTh6Mp+svPwYPlnZMyuj8WHTrM59wl/UI50jo61Qt/QubZ9tfsUc1sD62xdg3zgxC9quV4r+y7AkbfIDhbmxGqP64pWbZgFzOkP0JcSn+1xm/CB2E5IknKsAbwbYREGpiHM3nzZu+eLnvlfbzvTnJuJwBpLoPYQcnPvcgm+5gU1j1BjUaNKS/uDn7VbVm7hjbKA3wkniORC2TU2MiHElutnfrEVZ8wQfrCEpuWkOXs98H8QxUK4pBM2ea1xxGj7vREAZZg1x/Ci/E77gHxymnZ/ekhUIih6Pwu75jf+dvKcMnpmdLpwAVlE1G4dNginhFVyV/199llf9jmHasQQuaMFzQ9UMWGjA1Hg2KsaD9e3EL74A5fLkKc2EEmBD5v/aP+1RRZ3ISbTOXvxqYIFCdSFSCfPbUhkc9I2nHS0obEH7Q7KiuagoDqV0cTNXWfCGJ1DtIlGQ9IA6mPDAjX8Lg==",
"resource_key_hash": "SXOyPekBAUI95zuZSuJzsBlK4nO5SuJK4nNCPem5SuI="
}
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThis method facilitates migrating from the older Key Access Control List Service (KACLS1) to the newer KACLS (KACLS2) by converting Data Encryption Keys (DEKs) wrapped with KACLS1 to be wrapped with KACLS2.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003erewrap\u003c/code\u003e method requires an authorization token, the original KACLS URL, a reason for the operation, and the KACLS1-wrapped DEK in the request body.\u003c/p\u003e\n"],["\u003cp\u003eA successful response provides a KACLS2-wrapped DEK and a resource key hash, ensuring the encrypted data remains accessible and manageable within Google Workspace.\u003c/p\u003e\n"],["\u003cp\u003eKACLS providers should encrypt and return the DEK within the \u003ccode\u003ewrapped_key\u003c/code\u003e object to prevent lifetime discrepancies and ensure data integrity.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Workspace doesn't send deletion requests to KACLS when objects are deleted, implying KACLS providers manage key lifecycles independently.\u003c/p\u003e\n"]]],["The `rewrap` method migrates data encryption keys (DEKs) from KACLS1 to KACLS2. It requires a `POST` request to the KACLS URL, including a JSON body with the `authorization`, `original_kacls_url`, `reason`, and the KACLS1-wrapped `wrapped_key`. The successful response returns a KACLS2-wrapped `wrapped_key` and `resource_key_hash`, which should be stored with the encrypted object. The DEK should only exist in its encrypted state, and not stored in the KACLS.\n"],null,["# Method: rewrap\n\nThis method helps you migrate from the old Key Access Control List Service\n(KACLS1) to the newer KACLS (KACLS2). It takes a Data Encryption Key (DEK)\nwrapped with KACLS1's [`wrap`](/workspace/cse/reference/wrap) API, and returns a\nDEK wrapped with KACLS2's [`wrap`](/workspace/cse/reference/wrap) API.\n\n### HTTP request\n\n`POST https://`\u003cvar translate=\"no\"\u003eKACLS_URL\u003c/var\u003e`/rewrap`\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| ``` { \"authorization\": string, \"original_kacls_url\": string, \"reason\": string, \"wrapped_key\": string } ``` |\n\n| Fields ||\n|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\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| `original_kacls_url` | `string` URL of current wrapped_key's KACLS. |\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_key` | `string` The base64 binary object returned by [`wrap`](/workspace/cse/reference/wrap). |\n\n### Response body\n\nIf successful, this method returns an opaque binary object that will be stored\nby Google Workspace along the encrypted object and sent as-is in any subsequent\nkey unwrapping operation. It should also return the base64-encoded\n[resource_key_hash](/workspace/cse/reference/resource-key-hash).\n\nIf the operation fails, a\n[structured error reply](/workspace/cse/reference/structured-errors)\nshould be returned.\n\nThe binary object should contain the only copy of the encrypted DEK,\nimplementation specific data can be stored in it.\n\nDon't store the DEK in your KACLS system, instead encrypt it and return it in\nthe `wrapped_key` object. This prevents lifetime discrepancies between the\ndocument and its keys. For example, to ensure that the user's data is fully\nwiped out when they request it, or to make sure that previous versions restored\nfrom a backup will be decryptable.\n\nGoogle won't send deletion requests to the KACLS when objects are deleted.\n\n| JSON representation ||\n|----------------------------------------------------------------|---|\n| ``` { \"resource_key_hash\": string, \"wrapped_key\": string } ``` |\n\n| Fields ||\n|---------------------|-------------------------------------------------------------------------------------------------------------|\n| `resource_key_hash` | `string` base64 encoded binary object. See [resource key hash](/workspace/cse/reference/resource-key-hash). |\n| `wrapped_key` | `string` The base64-encoded binary object. Max size: 1 KB. |\n\n### Example\n\nThis example provides a sample request and response for the `rewrap` method.\n\n#### Request\n\n POST https://mykacls.example.com/v1/rewrap\n\n {\n \"wrapped_key\": \"7qTh6Mp+svVwYPlnZMyuj8WHTrM59wl/UI50jo61Qt/QubZ9tfsUc1sD62xdg3zgxC9quV4r+y7AkbfIDhbmxGqP64pWbZgFzOkP0JcSn+1xm/CB2E5IknKsAbwbYREGpiHM3nzZu+eLnvlfbzvTnJuJwBpLoPYQcnPvcgm+5gU1j1BjUaNKS/uDn7VbVm7hjbKA3wkniORC2TU2MiHElutnfrEVZ8wQfrCEpuWkOXs98H8QxUK4pBM2ea1xxGj7vREAZZg1x/Ci/E77gHxymnZ/ekhUIih6Pwu75jf+dvKcMnpmdLpwAVlE1G4dNginhFVyV/199llf9jmHasQQuaMFzQ9UMWGjA1Hg2KsaD9e3EL74A5fLkKc2EEmBD5v/aP+1RRZ3ISbTOXvxqYIFCdSFSCfPbUhkc9I2nHS0obEH7Q7KiuagoDqV0cTNXWfCGJ1DtIlGQ9IA6mPDAjX8Lg==\",\n \"authorization\": \"eyJhbGciOi...\",\n \"original_kacls_url\": \"https://original.example.com/kacls/v1\",\n \"reason\": \"{client:'drive' op:'read'}\"\n }\n\n#### Response\n\n {\n \"wrapped_key\": \"3qTh6Mp+svPwYPlnZMyuj8WHTrM59wl/UI50jo61Qt/QubZ9tfsUc1sD62xdg3zgxC9quV4r+y7AkbfIDhbmxGqP64pWbZgFzOkP0JcSn+1xm/CB2E5IknKsAbwbYREGpiHM3nzZu+eLnvlfbzvTnJuJwBpLoPYQcnPvcgm+5gU1j1BjUaNKS/uDn7VbVm7hjbKA3wkniORC2TU2MiHElutnfrEVZ8wQfrCEpuWkOXs98H8QxUK4pBM2ea1xxGj7vREAZZg1x/Ci/E77gHxymnZ/ekhUIih6Pwu75jf+dvKcMnpmdLpwAVlE1G4dNginhFVyV/199llf9jmHasQQuaMFzQ9UMWGjA1Hg2KsaD9e3EL74A5fLkKc2EEmBD5v/aP+1RRZ3ISbTOXvxqYIFCdSFSCfPbUhkc9I2nHS0obEH7Q7KiuagoDqV0cTNXWfCGJ1DtIlGQ9IA6mPDAjX8Lg==\",\n \"resource_key_hash\": \"SXOyPekBAUI95zuZSuJzsBlK4nO5SuJK4nNCPem5SuI=\"\n }"]]