diff --git a/webui/src/main/java/com/muwire/webui/SignServlet.java b/webui/src/main/java/com/muwire/webui/SignServlet.java
new file mode 100644
index 00000000..dc95e8eb
--- /dev/null
+++ b/webui/src/main/java/com/muwire/webui/SignServlet.java
@@ -0,0 +1,53 @@
+package com.muwire.webui;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.muwire.core.Core;
+
+import net.i2p.crypto.DSAEngine;
+import net.i2p.data.Base64;
+import net.i2p.data.Signature;
+
+public class SignServlet extends HttpServlet {
+
+ private Core core;
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ core = (Core) config.getServletContext().getAttribute("core");
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ String text = req.getParameter("text");
+ if (text == null) {
+ resp.sendError(503, "Nothing to sign?");
+ return;
+ }
+
+ byte [] payload = text.getBytes(StandardCharsets.UTF_8);
+ Signature sig = DSAEngine.getInstance().sign(payload, core.getSpk());
+
+ String response = Base64.encode(sig.getData());
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("");
+ sb.append("
" + signed + "" + } + } + xmlhttp.open("POST", "/MuWire/Sign", true) + xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xmlhttp.send(encodeURI("text=" + signText)) +} diff --git a/webui/src/main/webapp/AboutMe.jsp b/webui/src/main/webapp/AboutMe.jsp index 05ca172b..b2292473 100644 --- a/webui/src/main/webapp/AboutMe.jsp +++ b/webui/src/main/webapp/AboutMe.jsp @@ -20,6 +20,7 @@ Core core = (Core) application.getAttribute("core"); <%@include file="css.jsi"%> +