c# - SAML-2 Cannot create HTTP-REDIRECT binding signature URL parameter -


from understood, if want sign saml request, signature should constructed of:

samlrequest=value&relaystate=value&sigalg=value , should create signature, piece of code have used in order create signature:

var mscert = new x509certificate2(configurationmanager.appsettings["keyfilepath"], configurationmanager.appsettings["keyfilepassword"]); rsacryptoserviceprovider rsacsp = (rsacryptoserviceprovider)mscert.privatekey; cspparameters cspparam = new cspparameters(); cspparam.keycontainername = rsacsp.cspkeycontainerinfo.keycontainername; cspparam.keynumber = rsacsp.cspkeycontainerinfo.keynumber == keynumber.exchange ? 1 : 2; rsacryptoserviceprovider aescsp = new rsacryptoserviceprovider(cspparam); aescsp.persistkeyincsp = false; byte[] signed = aescsp.signdata(requestbytes, "sha256");  // testing purposes - testing signature bool isvalid = aescsp.verifydata(requestbytes, "sha256", signed); string signaturevalue = null;  // deflate signature string using (var output = new memorystream()) {     using (var zip = new deflatestream(output, compressionmode.compress))     {         zip.write(signed, 0, signed.length);     }     var base64 = convert.tobase64string(output.toarray());     var urlencode = httputility.urlencode(base64);     signaturevalue = urlencode; }     

and still, see validation fails, can 1 me see why?


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -