I am trying to encrypt/decrypt text given a cert thumbprint in the my service fabric app startup.
var encrypt = EncryptionUtility.EncryptText("testing123", "eb f6 36 ba 23 10 d3 3c 82 69 a1 7c 08 60 ad c0 fb 2e 60 bf", "My");
var decrypted = EncryptionUtility.DecryptText(encrypt, StoreLocation.LocalMachine);
I have an equivalent PowerShell script that actually works
# Encrypt Text
$thumbprint='eb f6 36 ba 23 10 d3 3c 82 69 a1 7c 08 60 ad c0 fb 2e 60 bf'
$encryptedText = Invoke-ServiceFabricEncryptText -Text 'test123' -CertThumbprint $thumbprint -CertStore -StoreLocation LocalMachine -StoreName My
# Decrypt Text
Invoke-ServiceFabricDecryptText -CipherText $encryptedText -StoreLocation "LocalMachine"
Current Behavior
DecryptText fails with:
Cannot find the certificate and private key to use for decryption. (Exception from HRESULT: 0x8009200C)
Stack Trace:
at System.Fabric.Security.EncryptionUtility.DecryptText(String textToDecrypt, StoreLocation storeLocation)
at My.Api.Startup.ConfigureServices(IServiceCollection services) in D:\temelj\My.FabricApp\src\My.Api\Startup.cs:line 97
I am trying to encrypt/decrypt text given a cert thumbprint in the my service fabric app startup.
I have an equivalent PowerShell script that actually works
Current Behavior
DecryptText fails with: Cannot find the certificate and private key to use for decryption. (Exception from HRESULT: 0x8009200C)
Stack Trace:
Service Fabric Runtime and SDK Version :
Runtime: 7.0.466.9590 SDK: 4.0.466.9590 .NET Core 3.1