tftviking
tftviking
CC#
Created by tftviking on 10/3/2023 in #help
❔ Load Certificate from Azure Key Vault as memorystream
I have a code that works perfect when testing it local and set my certificates as paths. When uploading it on Azure it do not work to use the path. My guess is that I have to upload the certificates on Key Vault and call the certificates from there. I'm using .NET Core Web App In the Nugget from Swish you can enter the certificate as direct path or as a stream. Do anyone have a solution how to fix this?
var clientCertificate = new SwishApi.Models.ClientCertificate()
{
CertificateFilePath = "Cert//Swish_Merchant_TestCertificate_1234679304.pfx",
Password = "swish"
};

string certificatePath = Environment.CurrentDirectory + "\\Cert\\Swish_Merchant_TestSigningCertificate_1234679304.pfx";
var payoutClient = new SwishApi.PayoutClient(clientCertificate, "https://eofvqci6optquip.m.pipedream.net", "1234", "1234679304", true, SwishApi.Environment.Emulator);

string instructionUUID = Guid.NewGuid().ToString("N").ToUpper();

// Anropa MakePayoutRequest med formulärvärden.
var response = payoutClient.MakePayoutRequest(PayoutTo, Personnummer, Amount, Message, instructionUUID, "7d70445ec8ef4d1e3a713427e973d097", new SwishApi.Models.ClientCertificate() { CertificateFilePath = certificatePath, Password = "swish" });
var clientCertificate = new SwishApi.Models.ClientCertificate()
{
CertificateFilePath = "Cert//Swish_Merchant_TestCertificate_1234679304.pfx",
Password = "swish"
};

string certificatePath = Environment.CurrentDirectory + "\\Cert\\Swish_Merchant_TestSigningCertificate_1234679304.pfx";
var payoutClient = new SwishApi.PayoutClient(clientCertificate, "https://eofvqci6optquip.m.pipedream.net", "1234", "1234679304", true, SwishApi.Environment.Emulator);

string instructionUUID = Guid.NewGuid().ToString("N").ToUpper();

// Anropa MakePayoutRequest med formulärvärden.
var response = payoutClient.MakePayoutRequest(PayoutTo, Personnummer, Amount, Message, instructionUUID, "7d70445ec8ef4d1e3a713427e973d097", new SwishApi.Models.ClientCertificate() { CertificateFilePath = certificatePath, Password = "swish" });
Have a look at this files : https://github.com/RickardPettersson/swish-api-csharp/blob/master/SwishApi/Models/ClientCertificate.cs https://github.com/RickardPettersson/swish-api-csharp/blob/master/SwishApi/PayoutClient.cs https://github.com/RickardPettersson/swish-api-csharp/issues/23
65 replies
CC#
Created by tftviking on 10/2/2023 in #help
Can't get Certificates when uploaded to Azure, works local.
I have built a web app that functions perfectly in my local environment. However, when I deploy it to Azure as a web app, I encounter issues with certificates, they cant be find in the Cert DIR. Its using : https://github.com/RickardPettersson/swish-api-csharp https://pastebin.com/Vbb9g4Nj Your insights and suggestions on how to resolve this issue would be greatly appreciated. Thank you!
22 replies