Subject: Validate Saml Response using .pem file
Date: 2014-10-31 19:05:21
From: Ashish Kumar
Source: validate-saml-response-using-pem-file

I am creating the SP and my Client (who has the IdP) has sent me a .pem file to Validate the Saml response.
Earlier I validated the response by a .pfx file and everything was fine.
Im not really expert with cryptography and find it quite difficult to even understand the difference between a .pfx file and a .pem file.
All I know is earlier I created an instance of X509Certificate2 from the .pfx file and used it to validate the response. But this time I cant seem to find a way to do it with .pem file.
My client is not willing to share the .pfx file as they say it might contains thier private key.
[code lang='c#']
var ssoSamlCertificatefile = "C:\Some\location\abcd.pem
var x509Certificate = new X509Certificate2(ssoSamlCertificatefile);
// Validate the SAML response with the certificate.
if (!samlResponse.Validate(x509Certificate))
    throw new ApplicationException("SAML response signature is not valid.");
Please help.
---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index