创建非对称密钥对
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本指南演示了如何为 Cloud Storage 存储分区创建非对称密钥对,
媒体 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
标头信息。
现在,有了这种格式的密钥,您就可以将其添加到密钥集了。
当密钥集以 cdnPolicy.signedRequestKeyset
的形式与路由关联时,
媒体 CDN 验证请求是否已在
提供任何内容
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-02。
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]