Member 11128915 Ответов: 0

Единого входа SAML метаданных не в состоянии генерировать метаданные, используя закрытый ключ(в формате строки )


Hello Friends,
I am Able To generate Metadata for SSO using Below code:
	 string path = HttpContext.Current.Server.MapPath("~/Certificates/test.cer");
     XmlDocument doc = new XmlDocument();
     EntityDescriptor spEntityDescriptor = CreateSPEntityDescriptor(HttpContext.Current.Server.MapPath(spCertificateFileName), spData);
     XmlElement xmlElement = spEntityDescriptor.ToXml();
     X509Certificate2 x509Certificate = new X509Certificate2(HttpContext.Current.Server.MapPath("~/Certificates/SPHasmukh.pfx"), "123456");
	 string private_key = x509Certificate.PrivateKey.ToXmlString(false);
	 SAMLMetadataSignature.Generate(xmlElement, x509Certificate.PrivateKey, x509Certificate);
	
	In This scenario i have Static below certificate File:
			SPHasmukh.pfx
			test.cer

But i want to generate Metadata using user Input:
	Where i have input as:
			ACS Url
			Entuty ID,
			SLO url,
			Private Key (In String Format)
			Certificate (In String Format)
	Using this detail i want to generate Metadata for sso.
	
Below are some code snippet of my code..
Please check attached screen shot of user input form.

Code:
var certificateObj=@"[Certificate Text]";

var PrivateKeyObj=@"Private Key Text"

X509Certificate2 x509Certificate = new X509Certificate2(certificateObj);
string private_key = x509Certificate.PrivateKey.ToXmlString(false);
SAMLMetadataSignature.Generate(xmlElement,PrivateKeyObj, x509Certificate);


I have certificateObj and PrivateKeyObj as string and i want use like This.
but its gives me error like "Failed to generate signature."

Please help me..

I want create Tool like Below link using component Space:
https://developers.onelogin.com/saml/online-tools/build-metadata/sp


Что я уже пробовал:

But i want to generate Metadata using user Input:
	Where i have input as:
			ACS Url
			Entuty ID,
			SLO url,
			Private Key (In String Format)
			Certificate (In String Format)
	Using this detail i want to generate Metadata for sso.
	
Below are some code snippet of my code..
Please check attached screen shot of user input form.

Code:
var certificateObj=@"[Certificate Text]";

var PrivateKeyObj=@"Private Key Text"

X509Certificate2 x509Certificate = new X509Certificate2(certificateObj);
string private_key = x509Certificate.PrivateKey.ToXmlString(false);
SAMLMetadataSignature.Generate(xmlElement,PrivateKeyObj, x509Certificate);

0 Ответов