שיטה: פענוח מפתח פרטי
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
פותח את האריזה של מפתח פרטי עטוף, ואז מפענח את מפתח ההצפנה של התוכן שמוצפן באמצעות המפתח הציבורי.
בקשת HTTP
POST https://KACLS_URL/privatekeydecrypt
מחליפים את KACLS_URL
בכתובת ה-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
JWT שהונפק על ידי ספק הזהויות (IdP) וכולל הצהרה לגבי זהות המשתמש. ראו אסימוני אימות.
|
authorization |
string
JWT שמאשר שלמשתמש יש הרשאה לפענח מפתח עבור resource_name . מידע על טוקנים של הרשאה
|
algorithm |
string
האלגוריתם ששימש להצפנת המפתח להצפנת נתונים (DEK) בהצפנת מעטפת.
|
encrypted_data_encryption_key |
string (UTF-8)
מפתח הצפנה של תוכן מוצפן בקידוד Base64, שמוצפן באמצעות המפתח הציבורי שמשויך למפתח הפרטי. גודל מקסימלי: 1KB.
|
rsa_oaep_label |
string
תווית L בקידוד Base64, אם האלגוריתם הוא RSAES-OAEP. אם האלגוריתם הוא לא RSAES-OAEP, המערכת מתעלמת מהשדה הזה.
|
reason |
string (UTF-8)
מחרוזת JSON של העברת נתונים שמספקת הקשר נוסף לגבי הפעולה. צריך לבצע סניטציה ל-JSON שסופק לפני שמציגים אותו. גודל מקסימלי: 1KB.
|
wrapped_private_key |
string
המפתח הפרטי העטוף בקידוד Base64. גודל מקסימלי: 8KB.
הפורמט של המפתח הפרטי או של המפתח הפרטי המוצפן תלוי בהטמעה של השירות למפתחות של בקרת גישה (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="
}
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-04 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-04 (שעון UTC)."],[[["\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 }"]]