Skip to content
Snippets Groups Projects
Commit b450bc08 authored by Felix Sidokhine's avatar Felix Sidokhine
Browse files

Added CRL servlet endpoint

parent b05237a4
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Base64;
import static net.jami.jams.server.Server.certificateAuthority;
......@@ -14,9 +15,15 @@ import static net.jami.jams.server.Server.certificateAuthority;
@WebServlet("/api/auth/crl")
public class CRLServlet extends HttpServlet {
private static final String CRL_HEAD = "-----BEGIN X509 CRL-----\n";
private static final String CRL_TAIL = "\n-----END X509 CRL-----";
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
certificateAuthority.getLatestCRL();
super.doGet(req, resp);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(CRL_HEAD);
stringBuilder.append(Base64.getEncoder().encodeToString(certificateAuthority.getLatestCRL().get().getEncoded()));
stringBuilder.append(CRL_TAIL);
resp.getOutputStream().write(stringBuilder.toString().getBytes());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment