public class CertificateProfile {
- final int id;
+ private final int id;
- final String keyName;
+ private final String keyName;
- final String visibleName;
+ private final String visibleName;
- static HashMap<String, CertificateProfile> byName = new HashMap<>();
+ private static HashMap<String, CertificateProfile> byName = new HashMap<>();
- static HashMap<Integer, CertificateProfile> byId = new HashMap<>();
+ private static HashMap<Integer, CertificateProfile> byId = new HashMap<>();
private CertificateProfile(int id, String keyName, String visibleName) {
this.id = id;
public enum Digest {
SHA256("Currently recommended, because the other algorithms" + " might break on some older versions of the GnuTLS library" + " (older than 3.x) still shipped in Debian for example."), SHA384(null), SHA512("Highest protection against hash collision attacks of the algorithms offered here.");
- final String exp;
+ private final String exp;
private Digest(String explanation) {
exp = explanation;
public class Domain {
- User owner;
+ private User owner;
- String suffix;
+ private String suffix;
- int id;
+ private int id;
public Domain(int id) throws SQLException {
PreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT memid, domain FROM `domains` WHERE id=? AND deleted IS NULL");
private HashMap<String, Page> pages = new HashMap<String, Page>();
- Menu m;
+ private Menu m;
public Gigi(Properties conf) {
DatabaseConnection.init(conf);
public class GigiApiException extends Exception {
- SQLException e;
+ private SQLException e;
- LinkedList<String> messages = new LinkedList<>();
+ private LinkedList<String> messages = new LinkedList<>();
public GigiApiException(SQLException e) {
super(e);
public static final String GIGI_CONFIG_VERSION = "GigiConfigV1.0";
- byte[] cacerts;
+ private byte[] cacerts;
- byte[] keystore;
+ private byte[] keystore;
- Properties mainProps = new Properties();
+ private Properties mainProps = new Properties();
private char[] keystorpw;
private int id;
- Name name = new Name(null, null, null, null);
+ private Name name = new Name(null, null, null, null);
- Date dob;
+ private Date dob;
- String email;
+ private String email;
public User(int id) {
this.id = id;
mimeEncode(contents, Base64.getEncoder().encodeToString(bOut.toByteArray()).replaceAll("(.{64})(?=.)", "$1\n"), to);
}
- static Random r = new Random();
+ private static Random r = new Random();
private static void mimeEncode(String contents, String signature, PrintWriter to) {
String boundary = generateBoundary(contents, null);
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.sql.Statement;
import java.util.HashMap;
import java.util.Properties;
-import java.sql.Statement;
public class DatabaseConnection {
public static final int CONNECTION_TIMEOUT = 24 * 60 * 60;
- Connection c;
+ private Connection c;
- HashMap<String, PreparedStatement> statements = new HashMap<String, PreparedStatement>();
+ private HashMap<String, PreparedStatement> statements = new HashMap<String, PreparedStatement>();
private static Properties credentials;
- Statement adHoc;
+ private Statement adHoc;
public DatabaseConnection() {
try {
return statement;
}
- long lastAction = System.currentTimeMillis();
+ private long lastAction = System.currentTimeMillis();
private void ensureOpen() {
if (System.currentTimeMillis() - lastAction > CONNECTION_TIMEOUT * 1000L) {
return id;
}
- static ThreadLocal<DatabaseConnection> instances = new ThreadLocal<DatabaseConnection>() {
+ private static ThreadLocal<DatabaseConnection> instances = new ThreadLocal<DatabaseConnection>() {
@Override
protected DatabaseConnection initialValue() {
class TestEmailProvider extends EmailProvider {
- ServerSocket servs;
+ private ServerSocket servs;
- Socket client;
+ private Socket client;
- DataOutputStream out;
+ private DataOutputStream out;
- DataInputStream in;
+ private DataInputStream in;
protected TestEmailProvider(Properties props) {
try {
private static HashMap<String, Language> langs = new HashMap<String, Language>();
- HashMap<String, String> translations = new HashMap<String, String>();
+ private HashMap<String, String> translations = new HashMap<String, String>();
- Locale l;
+ private Locale l;
protected Language(String language) throws ParserConfigurationException, IOException, SAXException {
if (language.contains("_")) {
public class CertificateIterable implements IterableDataset {
- Certificate[] certificates;
+ private Certificate[] certificates;
public CertificateIterable(Certificate[] certificates) {
this.certificates = certificates;
}
- int i = 0;
+ private int i = 0;
@Override
public boolean next(Language l, Map<String, Object> vars) {
public class ClientCSRGenerate {
- static Template normal;
+ private static Template normal;
- static Template IE;
+ private static Template IE;
static {
normal = new Template(ClientCSRGenerate.class.getResource("ClientCSRGenerate.templ"));
IE = new Template(ClientCSRGenerate.class.getResource("ClientCSRGenerateIE.templ"));
public class DateSelector implements Outputable {
- String[] names;
+ private String[] names;
public DateSelector(String day, String month, String year) {
this.names = new String[] {
};
}
- int day;
+ private int day;
- int month;
+ private int month;
- int year;
+ private int year;
@Override
public void output(PrintWriter out, Language l, Map<String, Object> vars) {
public static final String CSRF_FIELD = "csrf";
- String csrf;
+ private String csrf;
public Form(HttpServletRequest hsr) {
csrf = RandomToken.generateToken(32);
public class Menu implements Outputable {
- String menuName;
+ private String menuName;
- String id;
+ private String id;
private IMenuItem[] content;
public class MenuItem implements Outputable, IMenuItem {
- final String href;
+ private final String href;
- final String name;
+ private final String name;
public MenuItem(String href, String name) {
this.href = href;
public class HashAlgorithms implements IterableDataset {
- int i = 0;
+ private int i = 0;
- Digest selected;
+ private Digest selected;
public HashAlgorithms(Digest selected) {
this.selected = selected;
public class Template implements Outputable {
- TemplateBlock data;
+ private TemplateBlock data;
- long lastLoaded;
+ private long lastLoaded;
- File source;
+ private File source;
private static final Pattern CONTROL_PATTERN = Pattern.compile(" ?([a-z]+)\\(\\$([^)]+)\\) ?\\{ ?");
return null;
}
+ @Override
public void output(PrintWriter out, Language l, Map<String, Object> vars) {
if (source != null && DevelLauncher.DEVEL) {
if (lastLoaded < source.lastModified()) {
class TemplateBlock implements Outputable {
- String[] contents;
+ private String[] contents;
- Outputable[] vars;
+ private Outputable[] vars;
public TemplateBlock(String[] contents, Outputable[] vars) {
this.contents = contents;
1, 3, 6, 1, 5, 5, 7, 3, 9
});
- User u;
+ private User u;
private CSRType csrType;
- String csr;
+ private String csr;
- String spkacChallenge;
+ private String spkacChallenge;
public String CN = DEFAULT_CN;
- Set<SubjectAlternateName> SANs = new LinkedHashSet<>();
+ private Set<SubjectAlternateName> SANs = new LinkedHashSet<>();
- Digest selectedDigest = Digest.getDefault();
+ private Digest selectedDigest = Digest.getDefault();
- boolean login;
+ private boolean login;
- CertificateProfile profile = CertificateProfile.getById(1);
+ private CertificateProfile profile = CertificateProfile.getById(1);
public CertificateIssueForm(HttpServletRequest hsr) {
super(hsr);
spkacChallenge = RandomToken.generateToken(16);
}
- Certificate result;
+ private Certificate result;
public Certificate getResult() {
return result;
public class Certificates extends Page {
- Template certDisplay = new Template(Certificates.class.getResource("CertificateDisplay.templ"));
+ private Template certDisplay = new Template(Certificates.class.getResource("CertificateDisplay.templ"));
public static final String PATH = "/account/certs";
return true;
}
- Template certTable = new Template(CertificateIterable.class.getResource("CertificateTable.templ"));
+ private Template certTable = new Template(CertificateIterable.class.getResource("CertificateTable.templ"));
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
public class ChangeForm extends Form {
- User target;
+ private User target;
public ChangeForm(HttpServletRequest hsr, User target) {
super(hsr);
t = new Template(ChangePasswordPage.class.getResource("MailAddForm.templ"));
}
- User target;
+ private User target;
public MailAddForm(HttpServletRequest hsr, User target) {
super(hsr);
import java.io.IOException;
import java.io.PrintWriter;
+import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.Date;
import java.util.HashMap;
import java.util.Map;
public class Signup extends Form {
- User buildup = new User();
+ private User buildup = new User();
- Template t;
+ private Template t;
boolean general = true, country = true, regional = true, radius = true;
public class AssuranceForm extends Form {
- User assuree;
+ private User assuree;
- static final Template templ;
+ private static final Template templ;
static {
templ = new Template(AssuranceForm.class.getResource("AssuranceForm.templ"));
}
return false;
}
+ public User getAssuree() {
+ return assuree;
+ }
+
}
out.println(translate(req, check.getMessage()));
return;
}
- if (form == null || form.assuree.getId() != mid) {
+ if (form == null || form.getAssuree().getId() != mid) {
form = new AssuranceForm(req, mid);
}
}
AssuranceForm form = Form.getForm(req, AssuranceForm.class);
- if (mid != form.assuree.getId()) {
+ if (mid != form.getAssuree().getId()) {
return;
}
if (form.submit(out, req)) {
public class Job {
- int id;
+ private int id;
private Job(int id) {
this.id = id;
public class PasswordStrengthChecker {
- static Pattern digits = Pattern.compile("\\d");
+ private static Pattern digits = Pattern.compile("\\d");
- static Pattern lower = Pattern.compile("[a-z]");
+ private static Pattern lower = Pattern.compile("[a-z]");
- static Pattern upper = Pattern.compile("[A-Z]");
+ private static Pattern upper = Pattern.compile("[A-Z]");
- static Pattern whitespace = Pattern.compile("\\s");
+ private static Pattern whitespace = Pattern.compile("\\s");
- static Pattern special = Pattern.compile("(?!\\s)\\W");
+ private static Pattern special = Pattern.compile("(?!\\s)\\W");
private PasswordStrengthChecker() {}
public class RandomToken {
- static SecureRandom sr = new SecureRandom();
+ private static SecureRandom sr = new SecureRandom();
public static String generateToken(int length) {
StringBuffer token = new StringBuffer();