-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jonasjaguar/version-1.6
Version 1.6 Update
- Loading branch information
Showing
18 changed files
with
464 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.