Skip to content

Commit 67b28b6

Browse files
committed
cleanup
1 parent 1f911da commit 67b28b6

13 files changed

+34
-286
lines changed

dslink-core/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

dslink-v2/build.gradle

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ artifacts {
44
}
55

66
dependencies {
7-
compile 'org.bouncycastle:bcprov-jdk15on:+'
8-
compile 'org.bouncycastle:bcpkix-jdk15on:+'
97
testImplementation 'junit:junit:[4.12,)'
108
}
119

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/backup/SysBackupService.java

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
import org.iot.dsa.node.action.DSAction;
2626
import org.iot.dsa.time.DSTime;
2727

28+
/**
29+
* @author Daniel Shapiro
30+
* @author Aaron Hansen
31+
*/
2832
public class SysBackupService extends DSNode implements Runnable {
2933

3034
static final String ENABLED = "Enabled";

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/cert/AnonymousTrustFactory.java

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* falls back to the default Java trust manager.
2222
*
2323
* @author Aaron Hansen
24+
* @author Daniel Shapiro
2425
*/
2526
public class AnonymousTrustFactory extends TrustManagerFactorySpi {
2627

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/cert/CRLVerifier.java

-189
This file was deleted.

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/cert/CertCollection.java

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
import org.iot.dsa.node.DSNode;
99
import org.iot.dsa.time.DSTime;
1010

11+
/**
12+
* @author Daniel Shapiro
13+
*/
1114
public class CertCollection extends DSNode {
1215

1316
public void addCertificate(X509Certificate cert) throws CertificateEncodingException {

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/cert/CertNode.java

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import org.iot.dsa.node.action.ActionResult;
88
import org.iot.dsa.node.action.DSAction;
99

10+
/**
11+
* @author Daniel Shapiro
12+
*/
1013
public class CertNode extends DSValueNode {
1114

1215
private static final String VALUE = "value";

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/cert/HostnameWhitelist.java

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
import org.iot.dsa.node.action.ActionResult;
1212
import org.iot.dsa.node.action.DSAbstractAction;
1313

14+
/**
15+
* @author Daniel Shapiro
16+
*/
1417
public class HostnameWhitelist extends DSNode {
1518

1619
public static enum WhitelistValue {

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/cert/KeyToolUtil.java

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
import org.iot.dsa.logging.DSLogger;
1111
import org.iot.dsa.time.DSTime;
1212

13+
14+
/**
15+
* @author Daniel Shapiro
16+
*/
1317
public class KeyToolUtil extends DSLogger {
1418

1519
private static KeyToolUtil inst = new KeyToolUtil();

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/cert/SysCertManager.java

+6-95
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ public class SysCertManager extends DSNode {
4949
// Constants
5050
// ---------
5151

52-
private static final String ALLOW_CLIENTS = "Allow_Anonymous_Clients";
53-
private static final String ALLOW_SERVERS = "Allow_Anonymous_Servers";
54-
private static final String VERIFY_HOSTNAMES = "Enable Hostname Verification";
52+
private static final String ALLOW_CLIENTS = "Allow Anonymous Clients";
53+
private static final String ALLOW_SERVERS = "Allow Anonymous Servers";
54+
private static final String VERIFY_HOSTNAMES = "Enable Hostname-Certificate Verification";
5555
private static final String HOSTNAME_WHITELIST = "Hostname Whitelist";
56-
private static final String CERTFILE = "Cert_File";
57-
private static final String CERTFILE_PASS = "Cert_File_Pass";
58-
private static final String CERTFILE_TYPE = "Cert_File_Type";
56+
private static final String CERTFILE = "Cert File";
57+
private static final String CERTFILE_PASS = "Cert File Pass";
58+
private static final String CERTFILE_TYPE = "Cert File Type";
5959
private static final String LOCAL_TRUSTSTORE = "Local Truststore";
6060
private static final String QUARANTINE = "Quarantine";
6161
private static final String GENERATE_CSR = "Generate Certificate Signing Request";
@@ -372,94 +372,5 @@ public boolean verify(String hostname, SSLSession session) {
372372
}
373373
}
374374
}
375-
376-
// private static String generateCSR() {
377-
// KeyPairGenerator keyGen;
378-
// try {
379-
// keyGen = KeyPairGenerator.getInstance("RSA");
380-
// } catch (NoSuchAlgorithmException e) {
381-
// DSException.throwRuntime(e);
382-
// return null;
383-
// }
384-
// keyGen.initialize(2048, new SecureRandom());
385-
// KeyPair pair = keyGen.generateKeyPair();
386-
// PKCS10CertificationRequestBuilder p10Builder = new JcaPKCS10CertificationRequestBuilder(
387-
// new X500Principal("CN=dslink-java-v2, O=DSA, C=US"), pair.getPublic());
388-
// JcaContentSignerBuilder csBuilder = new JcaContentSignerBuilder("SHA256withRSA");
389-
// ContentSigner signer;
390-
// try {
391-
// signer = csBuilder.build(pair.getPrivate());
392-
// } catch (OperatorCreationException e) {
393-
// DSException.throwRuntime(e);
394-
// return null;
395-
// }
396-
// PKCS10CertificationRequest csr = p10Builder.build(signer);
397-
// StringWriter str = new StringWriter();
398-
// JcaPEMWriter pemWriter = new JcaPEMWriter(str);
399-
// try {
400-
// pemWriter.writeObject(csr);
401-
// } catch (IOException e) {
402-
// DSException.throwRuntime(e);
403-
// return null;
404-
// } finally {
405-
// try {
406-
// pemWriter.close();
407-
// str.close();
408-
// } catch (IOException e) {
409-
// DSException.throwRuntime(e);
410-
// return null;
411-
// }
412-
// }
413-
// return str.toString();
414-
// }
415-
416-
// private static X509Certificate generateSelfSigned() {
417-
// KeyPairGenerator keyGen;
418-
// try {
419-
// keyGen = KeyPairGenerator.getInstance("RSA");
420-
// } catch (NoSuchAlgorithmException e) {
421-
// DSException.throwRuntime(e);
422-
// return null;
423-
// }
424-
// keyGen.initialize(2048, new SecureRandom());
425-
// KeyPair pair = keyGen.generateKeyPair();
426-
//
427-
// Provider bcProvider = new BouncyCastleProvider();
428-
// Security.addProvider(bcProvider);
429-
//
430-
// long now = System.currentTimeMillis();
431-
// Date startDate = new Date(now);
432-
//
433-
// X500Name dname = new X500Name("CN=dslink-java-v2, O=DSA, C=US");
434-
// BigInteger certSerialNumber = new BigInteger(Long.toString(now)); // <-- Using the current timestamp as the certificate serial number
435-
//
436-
// Calendar calendar = Calendar.getInstance();
437-
// calendar.setTime(startDate);
438-
// calendar.add(Calendar.YEAR, 1); // <-- 1 Yr validity
439-
// Date endDate = calendar.getTime();
440-
//
441-
// String signatureAlgorithm = "SHA256WithRSA"; // <-- Use appropriate signature algorithm based on your keyPair algorithm.
442-
//
443-
// try {
444-
// ContentSigner contentSigner = new JcaContentSignerBuilder(signatureAlgorithm).build(pair.getPrivate());
445-
// JcaX509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(dname, certSerialNumber, startDate, endDate, dname, pair.getPublic());
446-
//
447-
// BasicConstraints basicConstraints = new BasicConstraints(true); // <-- true for CA, false for EndEntity
448-
// certBuilder.addExtension(new ASN1ObjectIdentifier("2.5.29.19"), true, basicConstraints); // Basic Constraints is usually marked as critical.
449-
//
450-
// return new JcaX509CertificateConverter().setProvider(bcProvider).getCertificate(certBuilder.build(contentSigner));
451-
// } catch (OperatorCreationException e) {
452-
// DSException.throwRuntime(e);
453-
// return null;
454-
// } catch (CertIOException e) {
455-
// DSException.throwRuntime(e);
456-
// return null;
457-
// } catch (CertificateException e) {
458-
// DSException.throwRuntime(e);
459-
// return null;
460-
// }
461-
//
462-
//
463-
// }
464375

465376
}

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/logging/LoggerNode.java

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
import org.iot.dsa.node.action.ActionResult;
99
import org.iot.dsa.node.action.DSAbstractAction;
1010

11+
/**
12+
* @author Daniel Shapiro
13+
*/
1114
public class LoggerNode extends StreamableLogNode {
1215

1316
private DSInfo levelInfo = getInfo("Log Level");

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/logging/StreamableLogNode.java

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import org.iot.dsa.node.action.ActionTable;
2121
import org.iot.dsa.node.action.DSAbstractAction;
2222

23+
/**
24+
* @author Daniel Shapiro
25+
*/
2326
public abstract class StreamableLogNode extends DSNode {
2427

2528
private static DSList levelRange;

0 commit comments

Comments
 (0)