- private void updateCertificateData(PrintWriter out, HttpServletRequest req) throws GigiApiException {
- o = req.getParameter("O");
- c = req.getParameter("C");
- st = req.getParameter("ST");
- l = req.getParameter("L");
+ private void checkCertData(HttpServletRequest req) throws GigiApiException {
+ o = extractParam(req, "O");
+ c = extractParam(req, "C");
+ st = extractParam(req, "ST");
+ l = extractParam(req, "L");
+
+ if (o.length() > 64 || o.length() < 1) {
+ throw new GigiApiException(SprintfCommand.createSimple("{0} not given or longer than {1} characters", "Organisation name", 64));
+ }
+ if (c.length() != 2) {
+ throw new GigiApiException(SprintfCommand.createSimple("{0} not given or not exactly {1} characters long", "Country code", 2));
+ }