//Initialize a pseudo-random number generator at start of the web serverhashalg is the hash algorithm used for signing and should be SHA256 or better.
public static Random rnd = new Random();
public static Object randLock = new Object(); // must be used for locking when accessing rnd
....
// Generate new challenge
byte[] bchallenge = new byte[128];
lock (randLock) { rnd.NextBytes(bchallenge); }
string challenge = BitConverter.ToString(bchallenge);
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sign Transaction</title>
<script>
"use strict";
function meineFunktion() {
var ifo = document.getElementById("info");
ifo.innerHTML = "Sending signing request ...";
document.SignRequest.submit();
}
</script>
</head>
<body>
<form name="SignRequest" method="post" action="https://myAppGW.company.com/signrq.html">
<input type="hidden" name="challenge" value="DB-95-E8-83-66-88-8B-E9-31-64-87-D2-6A-43-6C-39-14-C7-00-85" />
<input type="hidden" name="hashalg" value="SHA256" />
<input type="hidden" name="responsepath" value="https://myWeb.company.com/signresponse.aspx" />
</form>
<article>
<h1>Sign Transaction Response Test</h1>
<p id="info">...</p>
</article>
<button type="button" onclick="meineFunktion()">
Send Signing Request
</button>
</body>
</html>
reinhold.leitner@applicgate.com (C) November 2024 www.applicgate.com |