asp.netとmvcの究極のsamlライブラリを使用すると、AuthnRequestに簡単に署名できます。
AuthnRequestオブジェクトを作成し、Signメソッドを呼び出すだけで、この例を参照してください。 Ultimate saml library for asp.net and mvc
// Create a new instance of the AuthnRequest class.
AuthnRequest request = new AuthnRequest();
request.IsPassive = false;
// Set Protocol Binding.
request.ProtocolBinding = SamlBindingUri.HttpPost;
// Set the target provider's Assertion Consumer Service Url.
request.AssertionConsumerServiceUrl = "your url";
// Set Issuer
request.Issuer = new Issuer();
request.Issuer.NameIdentifier = "your name identifier";
request.NameIdPolicy = new NameIdPolicy();
request.NameIdPolicy.SpNameQualifier = "moodle.sp.myname";
request.NameIdPolicy.AllowCreate = true;
request.NameIdPolicy.Format = SamlNameIdentifierFormat.Persistent;
request.RequestedAuthnContext = new RequestedAuthnContext();
request.RequestedAuthnContext.Comparison = SamlAuthenticationContextComparison.Exact;
request.RequestedAuthnContext.AuthenticationContexts.Add(new AuthnContextClassRef(SamlAuthenticationContext.PasswordProtectedTransport));
// Send the request over HTTP POST
request.SendHttpPost(Response, "http://mybaseurl", "my_relay_state");
// Or you can send it over HTTP Redirect
// X509Certificate2 certificate = new X509Certificate2("PKey.pfx", "password");
// request.Redirect(Response, "http://mybaseurl", "my_relay_state", certificate.PrivateKey);