-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not Able to Trust the Certificate in the Azure Linux Container App #112485
Comments
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
Your certificate is just a base64 encoded DER. Loading it should look something like this: byte[] certBytes = Convert.FromBase64String(publicServiceCertificate);
X509Certificate2 cert = new(certBytes);
using (X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser, OpenFlags.ReadWrite)) {
store.Add(cert);
store.Close();
} |
This issue has been marked |
This issue has been automatically marked |
This issue will now be closed since it had been marked |
Description
Hi Team,
Hope you are doing well.
I'm not able to trust the Certificate to connect with the vault Hashicorp in the Azure Linux Container App and getting below Error. Same code of statement is working fine in the Windows environment.
Reproduction Steps
I tried to trust the certificate in the Azure Linux container using the below approaches but it's failing in the both cases.
In the publicServiceCertificate I'm using the string from the cert.txt file.
Cert.txt
Approach-1:
byte[] certBytes = Encoding.UTF8.GetBytes(publicServiceCertificate);
X509Certificate2 cert = new(certBytes);
using (X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser, OpenFlags.ReadWrite))
{
store.Add(cert);
store.Close();
}
Approach-2:
byte[] data = Convert.FromBase64String(publicServiceCertificate);
string certString = Encoding.UTF8.GetString(data);
X509Certificate2 cert = X509Certificate2.CreateFromPem(certString);
using (X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser, OpenFlags.ReadWrite))
{
store.Add(cert);
store.Close();
}
Expected behavior
After executing the Above code statement it should upload the certificate in the azure environment and should trust the application to establish the connection with Vault Hashicorp.
Actual behavior
When I tried to executing Code (Mentioned in the Reproduction Steps) it's returning below error.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: