简体   繁体   English

从 base64 编码字符串创建证书在 Azure Function 中失败

[英]Creating Certificate from base64 encoded string failing in Azure Function

I am trying to create an X509Certificate2 from a base64 encoded string.我正在尝试从 base64 编码字符串创建X509Certificate2 This code I have added to a sample Azure function.我已将此代码添加到示例 Azure function 中。 Locally the code works and I can create a cerificate object from bas364 encoded string, however when publishing to Azure I get an exception在本地代码有效,我可以从 bas364 编码字符串创建证书 object,但是在发布到 Azure 时出现异常
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException at Internal.Cryptography.Pal.CertificatePal.FilterPFXStore Following https://github.com/dotnet/runtime/issues/30658 I have kept app service plan as '(P1v2: 1)' which is not shared. Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException at Internal.Cryptography.Pal.CertificatePal.FilterPFXStore遵循https://github.com/dotnet/runtime/issues/30658我将应用服务计划保留为“(P1v2:1)”,这不是共享。

Use WEBSITE_LOAD_CERTIFICATES app setting in your azure function the specified certificates accessible to your Windows hosted app in the Windows certificate store, in Current_User\Your_user . Use WEBSITE_LOAD_CERTIFICATES app setting in your azure function the specified certificates accessible to your Windows hosted app in the Windows certificate store, in Current_User\Your_user .

In your code, access the certificate by the certificate thumbprint.在您的代码中,通过证书指纹访问证书。 Like certificateThumbprint = "<your certificate thumbprint>";certificateThumbprint = "<your certificate thumbprint>";

Note: App Service inject the certificate paths into Windows containers.注意:应用服务将证书路径注入 Windows 容器。 like variables WEBSITE_PRIVATE_CERTS_PATH , WEBSITE_INTERMEDIATE_CERTS_PATH , WEBSITE_PUBLIC_CERTS_PATH , and WEBSITE_ROOT_CERTS_PATH .像变量WEBSITE_PRIVATE_CERTS_PATHWEBSITE_INTERMEDIATE_CERTS_PATHWEBSITE_PUBLIC_CERTS_PATHWEBSITE_ROOT_CERTS_PATH Make sure you have to reference the certificate path with the environment variables instead of hardcoding the certificate path.确保您必须使用环境变量引用证书路径,而不是对证书路径进行硬编码。

If still, you are facing the same issue you can add the WEBSITE_LOAD_USER_PROFILE=1 app settings in your app.如果仍然存在,您也面临同样的问题,您可以在您的应用中添加WEBSITE_LOAD_USER_PROFILE=1应用设置。 The error says that the certificate not accessible for specific user.该错误表示特定用户无法访问该证书。 It will fix your problem.它将解决您的问题。

Refer here for more information请参阅此处了解更多信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将从 API 返回的 PNG 转换为 JPG,然后转换为 Azure 函数中的 Base64 编码字符串 - Converting a PNG returned from an API to a JPG, then to a Base64 encoded string in an Azure function 从 base64 编码字符串解析 Azure 逻辑应用程序中的 JSON 数组,以在 For_each 中使用 - Parsing JSON array in Azure Logic App from base64 encoded string to use in For_each Azure 逻辑应用无法使用转换后的 base64 编码 pfx 创建客户端证书身份验证 - Azure Logic App not able create client certificate authentication with converted base64 encoded pfx Azure - Constructing X509Certificate2 from base64 in Azure Function results in error: The specified network password is not correct - Azure - Constructing X509Certificate2 from base64 in Azure Function results in error: The specified network password is not correct 可以添加到Azure队列的base64编码字符串的最大长度是多少? - What is the maximum length of base64 encoded string that can be added to Azure queue? 从Java的Azure Blob存储下载数据后,如何在图像中嵌入base64编码的数据? - How to embed base64 encoded data in image after downloading data from Azure Blob Storage in Javascript? azure signaturehash 从 debug.keystore 拒绝我的 Base64 编码的 SHA1 hash - azure signaturehash rejects my Base64 encoded SHA1 hash from debug.keystore Azure:解码包含图片的base64中的字符串 - Azure: decoding a string in base64 containing a picture 在azure存储上将base64字符串解码为jpeg - decoding base64 string as jpeg on azure storage 如何从 Azure Function 返回 base64 图像作为二进制数据 - How to return base64 image from Azure Function as binary data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM