aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/data
diff options
context:
space:
mode:
authorJ08nY2017-03-09 00:46:35 +0100
committerJ08nY2017-03-09 00:46:35 +0100
commitea77f29683c8721ae1581b76f3f6b83ee26720bc (patch)
tree8b8c432e6913e17329f09668349d796435914e05 /src/cz/crcs/ectester/data
parentc6cb9f4cda4391713bd59cc1e1e7cae8d50cf331 (diff)
downloadECTester-ea77f29683c8721ae1581b76f3f6b83ee26720bc.tar.gz
ECTester-ea77f29683c8721ae1581b76f3f6b83ee26720bc.tar.zst
ECTester-ea77f29683c8721ae1581b76f3f6b83ee26720bc.zip
Reader: fixed ECDH and ECDSA output, also named curve testing
Diffstat (limited to 'src/cz/crcs/ectester/data')
-rw-r--r--src/cz/crcs/ectester/data/EC_Data.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/cz/crcs/ectester/data/EC_Data.java b/src/cz/crcs/ectester/data/EC_Data.java
index a867fcf..0c4bda2 100644
--- a/src/cz/crcs/ectester/data/EC_Data.java
+++ b/src/cz/crcs/ectester/data/EC_Data.java
@@ -10,7 +10,9 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
@@ -29,12 +31,12 @@ import java.util.Map;
*/
public class EC_Data {
- private DocumentBuilderFactory dbf;
+ private DocumentBuilder db;
private Map<String, EC_Category> categories;
public EC_Data() {
- dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
SchemaFactory scf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -43,6 +45,23 @@ public class EC_Data {
dbf.setNamespaceAware(true);
dbf.setIgnoringComments(true);
dbf.setIgnoringElementContentWhitespace(true);
+ db = dbf.newDocumentBuilder();
+ db.setErrorHandler(new ErrorHandler() {
+ @Override
+ public void warning(SAXParseException exception) throws SAXException {
+ System.err.println("EC_Data | Warning : " + exception);
+ }
+
+ @Override
+ public void error(SAXParseException exception) throws SAXException {
+ System.err.println("EC_Data | Error : " + exception);
+ }
+
+ @Override
+ public void fatalError(SAXParseException exception) throws SAXException {
+ System.err.println("EC_Data | Fatal : " + exception);
+ }
+ });
parse();
} catch (ParserConfigurationException | IOException | SAXException e) {
@@ -51,7 +70,6 @@ public class EC_Data {
}
private void parse() throws SAXException, ParserConfigurationException, IOException {
- DocumentBuilder db = dbf.newDocumentBuilder();
Document categoriesDoc = db.parse(this.getClass().getResourceAsStream("/cz/crcs/ectester/data/categories.xml"));
categoriesDoc.normalize();
@@ -76,7 +94,6 @@ public class EC_Data {
}
private EC_Category parseCategory(String name, String dir, String desc) throws ParserConfigurationException, IOException, SAXException {
- DocumentBuilder db = dbf.newDocumentBuilder();
Map<String, EC_Params> objMap = new HashMap<>();