Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.6 Update #2

Merged
merged 6 commits into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
----- CHANGELOG FOR FILECRYPT SOFTWARE -----



Version 1.0:

- First Software Release

- Encrypting Concept finished

- File Selection Concept finished



Version 1.4:

- Added Possibility to change RSA key length

- Added Possibility to Auto-Delete Files After Encrypting

- Prevents User from Clicking "Encrypt!" Again while encryption process is running



Version 1.5:

- Added Auto-Save while Encrypting to reduce RAM usage

- Added Possibility to Change the Auto-Save Interval

NOTE: Crashes at the End of Encrypting Process, please use a newer Version



Version 1.6:

- Fixed 1.5 Auto-Save crash bug

- Uploaded Source on GitHub

- Did Some small improvement
6 changes: 6 additions & 0 deletions FileCrypt/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions FileCrypt/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FileCrypt</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions FileCrypt/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Binary file added FileCrypt/bin/filecrypt/EncryptionAPI.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/FileAPI.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/FileCryptGUI$1.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/FileCryptGUI$2.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/FileCryptGUI$3$1.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/FileCryptGUI$3.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/FileCryptGUI$4.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/FileCryptGUI$5.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/FileCryptGUI.class
Binary file not shown.
Binary file added FileCrypt/bin/filecrypt/filecrypt_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions FileCrypt/src/filecrypt/EncryptionAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package filecrypt;

import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;

public class EncryptionAPI {

public static KeyPair key;

public static void gen(int length)
{
KeyPairGenerator keygen = null;
try
{
keygen = KeyPairGenerator.getInstance("RSA");
} catch (NoSuchAlgorithmException e)
{
e.printStackTrace();
}
keygen.initialize(length);
key = keygen.generateKeyPair();
}

public static byte[] encrypt(String message, PublicKey pk)
{
Cipher cipher = null;
try
{
cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, pk);
} catch (NoSuchAlgorithmException e)
{
e.printStackTrace();
} catch (NoSuchPaddingException e)
{
e.printStackTrace();
} catch (InvalidKeyException e)
{
e.printStackTrace();
}
byte[] chiffrat = null;
try
{
chiffrat = cipher.doFinal(message.getBytes());
} catch (IllegalBlockSizeException | BadPaddingException e)
{
e.printStackTrace();
chiffrat = new byte[3];
chiffrat[1] = 1;
chiffrat[0] = 25;
chiffrat[2] = 52;
}
return chiffrat;
}

public static String decrypt(byte[] chiffrat, PrivateKey sk)
{
byte[] dec = null;
Cipher cipher = null;
try
{
cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.DECRYPT_MODE, sk);
} catch (NoSuchAlgorithmException e1)
{
e1.printStackTrace();
} catch (NoSuchPaddingException e1)
{
e1.printStackTrace();
} catch (InvalidKeyException e)
{
e.printStackTrace();
}

try
{
dec = cipher.doFinal(chiffrat);
} catch (IllegalBlockSizeException | BadPaddingException e)
{
e.printStackTrace();
}
return new String(dec);
}

}
57 changes: 57 additions & 0 deletions FileCrypt/src/filecrypt/FileAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package filecrypt;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class FileAPI {

//public static BufferedWriter out = null;
public static BufferedReader in = null;

public static String[] readFile(File file) {
String currLine;
ArrayList<String> linesTEMP = new ArrayList<String>();
try {
in = new BufferedReader(new FileReader(file));
while((currLine = in.readLine()) != null) {
linesTEMP.add(currLine);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
String[] lines = new String[linesTEMP.size()];
for (int i = 0; i < linesTEMP.size(); i++) {
lines[i] = linesTEMP.get(i);
}

return lines;
}

public static void writeFile(File file, String[] msg, BufferedWriter out) {

try {
for (int i = 0; i < msg.length; i++) {
if (msg[i] != null) {
out.write(msg[i]);
out.newLine();
}
}
} catch (IOException e) {
e.printStackTrace();
}

}

}
Loading