Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
建立非對稱式金鑰組
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本指南說明如何為 Media CDN 建立非對稱金鑰配對。
產生金鑰
指令列
您可以使用 Python 3 和 OpenSSL 1.1.1 以上版本 (舊版 OpenSSL 不支援 Ed25519),產生私密和公開金鑰。
產生私密金鑰。
openssl genpkey -algorithm ed25519 -outform PEM -out test.private.key
這會輸出 PEM 編碼的私密金鑰。請妥善保管這項金鑰,最好是使用金鑰管理系統或 Secret Manager。
從採用網址安全 Base64 格式的私密金鑰產生公開金鑰。
openssl pkey -outform DER -pubout -in test.private.key | tail -c +13 | python3 -c "import base64, sys; print(('%s' % base64.urlsafe_b64encode(sys.stdin.buffer.read()))[2:-1])"
這個指令會從私密金鑰產生公開金鑰,並從原始公開金鑰中移除 ASN.1 標頭資訊。
有了這種格式的金鑰,您現在可以將金鑰新增至金鑰集。
金鑰組與路徑建立關聯後,Media CDN 會先驗證要求是否已簽署,再提供任何內容。cdnPolicy.signedRequestKeyset
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-05-16 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2026-05-16 (世界標準時間)。"],[],[]]