Skip to content

Commit

Permalink
fix deb config
Browse files Browse the repository at this point in the history
  • Loading branch information
youssefshibl committed Nov 6, 2024
1 parent 27b4f33 commit 9f3918c
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 51 deletions.
Binary file added encrypto.deb
Binary file not shown.
Binary file added encrypto/DEBIAN/changelog.Debian.gz
Binary file not shown.
9 changes: 9 additions & 0 deletions encrypto/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Package: encrypto
Version: 1.0-1
Section: utils
Priority: optional
Architecture: amd64
Maintainer: Baeldung <[email protected]>
Description: this software does some work
This is its extended description.
Extended-Description: test desc
Binary file added encrypto/bin/encrypto
Binary file not shown.
Binary file added encrypto/usr/share/doc/encrypto/changelog.Debian.gz
Binary file not shown.
14 changes: 14 additions & 0 deletions encrypto/usr/share/doc/encrypto/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
encrypto

Copyright: 2020 Baeldung <[email protected]>

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)
25 changes: 15 additions & 10 deletions src/main/java/com/encrypservice/socket/NioSslClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
23 changes: 14 additions & 9 deletions src/main/java/com/encrypservice/socket/NioSslServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

This file was deleted.

29 changes: 0 additions & 29 deletions test/Main.java

This file was deleted.

1 change: 0 additions & 1 deletion test/native/test.txt

This file was deleted.

1 change: 0 additions & 1 deletion test/test.txt

This file was deleted.

0 comments on commit 9f3918c

Please sign in to comment.