import java.io.ObjectOutputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
+import java.math.BigInteger;
import java.util.LinkedList;
import java.util.List;
this.id = id;
}
- protected CertificateOwner() {
+ /**
+ * This constructor has a dummy parameter to allow callers to do checks
+ * before invoking the super constructor.
+ *
+ * @param dummy
+ * a parameter that is not used to allow callers to do checks
+ * before super constructor invocation.
+ */
+ protected CertificateOwner(Void dummy) {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `certOwners` DEFAULT VALUES")) {
ps.execute();
id = ps.lastInsertId();
}
}
- public static CertificateOwner getByEnabledSerial(String serial) {
+ public static CertificateOwner getByEnabledSerial(BigInteger serial) {
try (GigiPreparedStatement prep = new GigiPreparedStatement("SELECT `memid` FROM `certs` INNER JOIN `logincerts` ON `logincerts`.`id`=`certs`.`id` WHERE serial=? AND `revoked` is NULL")) {
- prep.setString(1, serial);
+ prep.setString(1, serial.toString(16));
GigiResultSet res = prep.executeQuery();
if (res.next()) {
return getById(res.getInt(1));