C#C
C#3y ago
tftviking

❔ 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" });


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
Was this page helpful?