preparedStatement.setString(1, gatewayName);
ResultSet resultSet = preparedStatement.executeQuery();
CertificateCredential certificateCredential;
while (resultSet.next()) {
certificateCredential = new CertificateCredential();
certificateCredential.setCommunityUser(new CommunityUser(gatewayName,
resultSet.getString("COMMUNITY_USER_NAME"), null));
Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());
Blob blobPK = resultSet.getBlob("PRIVATE_KEY");
byte[] pk = blobPK.getBytes(1, (int) blobPK.length());
certificateCredential.setCertificate((X509Certificate) convertByteArrayToObject(certificate));
certificateCredential.setPrivateKey((PrivateKey) convertByteArrayToObject(pk));
certificateCredential.setNotBefore(resultSet.getString("NOT_BEFORE"));
certificateCredential.setNotBefore(resultSet.getString("NOT_AFTER"));
certificateCredential.setLifeTime(resultSet.getLong("LIFETIME"));
certificateCredential.setPortalUserName(resultSet.getString("REQUESTING_PORTAL_USER_NAME"));
certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("REQUESTED_TIME"));
credentialList.add(certificateCredential);
}
} catch (SQLException e) {