diff --git a/encrypto.deb b/encrypto.deb new file mode 100644 index 0000000..db8e462 Binary files /dev/null and b/encrypto.deb differ diff --git a/encrypto/DEBIAN/changelog.Debian.gz b/encrypto/DEBIAN/changelog.Debian.gz new file mode 100644 index 0000000..94e6cb3 Binary files /dev/null and b/encrypto/DEBIAN/changelog.Debian.gz differ diff --git a/encrypto/DEBIAN/control b/encrypto/DEBIAN/control new file mode 100644 index 0000000..b2055d8 --- /dev/null +++ b/encrypto/DEBIAN/control @@ -0,0 +1,9 @@ +Package: encrypto +Version: 1.0-1 +Section: utils +Priority: optional +Architecture: amd64 +Maintainer: Baeldung +Description: this software does some work + This is its extended description. +Extended-Description: test desc diff --git a/encrypto/bin/encrypto b/encrypto/bin/encrypto new file mode 100755 index 0000000..fbbc210 Binary files /dev/null and b/encrypto/bin/encrypto differ diff --git a/encrypto/usr/share/doc/encrypto/changelog.Debian.gz b/encrypto/usr/share/doc/encrypto/changelog.Debian.gz new file mode 100644 index 0000000..94e6cb3 Binary files /dev/null and b/encrypto/usr/share/doc/encrypto/changelog.Debian.gz differ diff --git a/encrypto/usr/share/doc/encrypto/copyright b/encrypto/usr/share/doc/encrypto/copyright new file mode 100644 index 0000000..5f51786 --- /dev/null +++ b/encrypto/usr/share/doc/encrypto/copyright @@ -0,0 +1,14 @@ +encrypto + +Copyright: 2020 Baeldung + +2020-12-23 + +The entire code base may be distributed under the terms of the GNU General +Public License (GPL), which appears immediately below. Alternatively, all +of the source code as any code derived from that code may instead be +distributed under the GNU Lesser General Public License (LGPL), at the +choice of the distributor. The complete text of the LGPL appears at the +bottom of this file. + +See /usr/share/common-licenses/(GPL|LGPL) \ No newline at end of file diff --git a/src/main/java/com/encrypservice/socket/NioSslClient.java b/src/main/java/com/encrypservice/socket/NioSslClient.java index a4e4782..a9e94a2 100644 --- a/src/main/java/com/encrypservice/socket/NioSslClient.java +++ b/src/main/java/com/encrypservice/socket/NioSslClient.java @@ -10,6 +10,8 @@ import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.nio.channels.spi.SelectorProvider; +import java.nio.file.Path; +import java.nio.file.Paths; import java.security.KeyStore; import java.security.SecureRandom; import java.util.Iterator; @@ -42,16 +44,19 @@ public NioSslClient(Arguments arguments) throws Exception { this.arguments = arguments; SSLContext context = SSLContext.getInstance("TLSv1.2"); // load files - File jarDir; - try { - jarDir = new File(NioSslServer.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile(); - System.out.println("JAR file path: " + jarDir.getAbsolutePath()); - } catch (URISyntaxException e) { - throw new IOException("Error determining the JAR directory.", e); - } - - File keyStoreFile = new File(jarDir, "client.jks"); - File trustStoreFile = new File(jarDir, "trustedCerts.jks"); + // File jarDir; + // try { + // jarDir = new File(NioSslServer.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile(); + // System.out.println("JAR file path: " + jarDir.getAbsolutePath()); + // } catch (URISyntaxException e) { + // throw new IOException("Error determining the JAR directory.", e); + // } + Path executableDir = Paths.get(System.getProperty("user.dir")); + + // File keyStoreFile = new File(jarDir, "client.jks"); + // File trustStoreFile = new File(jarDir, "trustedCerts.jks"); + File keyStoreFile = new File(executableDir.toFile(), "client.jks"); + File trustStoreFile = new File(executableDir.toFile(), "trustedCerts.jks"); // Load keystore and truststore from resources try (InputStream keyStoreStream = new FileInputStream(keyStoreFile); diff --git a/src/main/java/com/encrypservice/socket/NioSslServer.java b/src/main/java/com/encrypservice/socket/NioSslServer.java index e02af22..ea05469 100644 --- a/src/main/java/com/encrypservice/socket/NioSslServer.java +++ b/src/main/java/com/encrypservice/socket/NioSslServer.java @@ -26,6 +26,8 @@ import java.io.FileInputStream; import java.io.File; import java.net.URISyntaxException; +import java.nio.file.Path; +import java.nio.file.Paths; import com.encrypservice.Arguments; @@ -39,15 +41,18 @@ public class NioSslServer extends NioSslPeer { public NioSslServer(Arguments args) throws Exception { this.arguments = args; - File jarDir; - try { - jarDir = new File(NioSslServer.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile(); - System.out.println("JAR file path: " + jarDir.getAbsolutePath()); - } catch (URISyntaxException e) { - throw new IOException("Error determining the JAR directory.", e); - } - File keyStoreFile = new File(jarDir, "server.jks"); - File trustStoreFile = new File(jarDir, "trustedCerts.jks"); + // File jarDir; + // try { + // jarDir = new File(NioSslServer.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile(); + // System.out.println("JAR file path: " + jarDir.getAbsolutePath()); + // } catch (URISyntaxException e) { + // throw new IOException("Error determining the JAR directory.", e); + // } + Path executableDir = Paths.get(System.getProperty("user.dir")); + // File keyStoreFile = new File(jarDir, "server.jks"); + // File trustStoreFile = new File(jarDir, "trustedCerts.jks"); + File keyStoreFile = new File(executableDir.toFile(), "server.jks"); + File trustStoreFile = new File(executableDir.toFile(), "trustedCerts.jks"); context = SSLContext.getInstance("TLSv1.2"); try (InputStream keyStoreStream = new FileInputStream(keyStoreFile); diff --git a/test/META-INF/native-image/com/encrypservice/encrypto/reachability-metadata.json b/test/META-INF/native-image/com/encrypservice/encrypto/reachability-metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/test/META-INF/native-image/com/encrypservice/encrypto/reachability-metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/Main.java b/test/Main.java deleted file mode 100644 index f03b8fb..0000000 --- a/test/Main.java +++ /dev/null @@ -1,29 +0,0 @@ - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -public class Main { - public static void main(String[] args) { - // get current path and add the file name - Path path = Paths.get(System.getProperty("user.dir"), "test.txt"); - // print path - System.out.println(path.toString()); - - try { - // Read path file - InputStream is = Files.newInputStream(path); - BufferedReader br = new BufferedReader(new InputStreamReader(is)); - String line; - while ((line = br.readLine()) != null) { - System.out.println(line); - } - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/test/native/test.txt b/test/native/test.txt deleted file mode 100644 index f855b1c..0000000 --- a/test/native/test.txt +++ /dev/null @@ -1 +0,0 @@ -test one diff --git a/test/test.txt b/test/test.txt deleted file mode 100644 index f855b1c..0000000 --- a/test/test.txt +++ /dev/null @@ -1 +0,0 @@ -test one