Skip to content

Commit

Permalink
fix: removed generic exception logging, and changed exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryIvo committed Oct 12, 2023
1 parent a9ebe52 commit 2ff3a7f
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -179,16 +180,17 @@ private static void create8021xTls(NetworkProperties props, String deviceId, Map
Certificate clientCert = props.get(Certificate.class, "net.interface.%s.config.802-1x.client-cert-name",
deviceId);
settings.put("client-cert", new Variant<>(clientCert.getEncoded()));
} catch (Exception e) {
logger.error("Unable to find or decode Client Certificate", e);
} catch (CertificateEncodingException e) {
logger.error("Unable to find or decode Client Certificate");
}

try {
PrivateKey privateKey = props.get(PrivateKey.class, "net.interface.%s.config.802-1x.private-key-name",
deviceId);
PrivateKey privateKey = props.get(PrivateKey.class, "net.interface.%s.config.802-1x.private-key-name",
deviceId);

if (privateKey.getEncoded() != null) {
settings.put("private-key", new Variant<>(privateKey.getEncoded()));
} catch (Exception e) {
logger.error("Unable to find or decode Private Key", e);
} else {
logger.error("Unable to find or decode Private Key");
}

Optional<Password> privateKeyPassword = props.getOpt(Password.class,
Expand Down

0 comments on commit 2ff3a7f

Please sign in to comment.