Dynamic SAML config certificate error

When trying to dynamically pull the certificate from the database, I receive this error:

The X.509 certificate with find type: FindByThumbprint and find value: xxxxxxxxxxxxxxxxxxxxxxxxxx could not be found in the X.509 store LocalMachine.


What am I doing wrong? We are new to Component Space and trying to figure out if it will work for our needs.

string ssoURL = "<a href=“https://test1.com/samlservice";">https://test1.com/samlservice”;
string providerName = “test1”;
string assertionURL = "<a href=“http://test2.com/samlAssertion.aspx";">http://test2.com/samlAssertion.aspx”;
string serviceName = “test2”;
var config = new SAMLConfiguration();

PartnerIdentityProviderConfiguration pId = new PartnerIdentityProviderConfiguration();
pId.SingleSignOnServiceUrl = ssoURL;
pId.Name = providerName;
pId.WantSAMLResponseSigned = true;
pId.WantAssertionSigned = false;
pId.WantAssertionEncrypted = false;
pId.SignAuthnRequest = false;

X509Certificate2 x509Certificate = new X509Certificate2(GetCertBytes());
pId.PartnerCertificateThumbprint = x509Certificate.Thumbprint;
config.AddPartnerIdentityProvider(pId);

LocalServiceProviderConfiguration sId = new LocalServiceProviderConfiguration();
sId.AssertionConsumerServiceUrl = assertionURL;
sId.Name = serviceName;
config.LocalServiceProviderConfiguration = sId;

SAMLConfiguration.Current = config;

Hi Brian
The PartnerCertificateThumbprint property identifies a certificate within the Windows certificate store by its thumbprint.
The error indicates that the certificate is not in the Windows certificate store.
Where are you storing the X.509 certificate?
By default we support certificates stored on the file system or in the Windows certificate store.
If you wish to store the certificates in a database or elsewhere you will need to implement the ComponentSpace.SAML2.Certificates.ICertificateManager interface.
However, it’s usually easier to store certificates on the file system or Windows certificate store.