Skip to content
Snippets Groups Projects
Commit 31930bb5 authored by Schlütter Yannik's avatar Schlütter Yannik
Browse files

Fix: Passwords for both Databases and Moved CryptoException.java in Exception Package

parent 7321a722
No related branches found
No related tags found
4 merge requests!74V1,!73Initial commit,!71Merge DataBase into Development,!8Merge database branch into development branch
package de.hdm_stuttgart.battlearena.Persistance.Classes;
package de.hdm_stuttgart.battlearena.Exceptions;
public class CryptoException extends Exception{
public CryptoException(String message, Throwable throwable) {
......
package de.hdm_stuttgart.battlearena.Persistance.Classes;
import de.hdm_stuttgart.battlearena.Exceptions.CryptoException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
......@@ -21,10 +23,10 @@ public class CryptoUtils{
private static final String ALGORITHM = "AES";
private static final String TRANSFORMATION = "AES/ECB/PKCS5Padding";
/*public static void encrypt(String key, File inputFile, File outputFile)
public static void encrypt(String key, File inputFile)
throws CryptoException {
doCrypto(Cipher.ENCRYPT_MODE, key, inputFile,outputFile);
}*/
doCrypto(Cipher.ENCRYPT_MODE, key, inputFile);
}
public static String[] decrypt(String key, File inputFile)
throws CryptoException {
......@@ -45,10 +47,15 @@ public class CryptoUtils{
byte[] outputBytes = cipher.doFinal(inputBytes);
String completeString = new String(outputBytes, StandardCharsets.UTF_8);
//System.out.println(completeString);
System.out.println(completeString);
parts = completeString.split(";");
//FileOutputStream outputStream = new FileOutputStream(outputFile);
//outputStream.write(outputBytes);
inputStream.close();
//outputStream.close();
} catch (NoSuchPaddingException | NoSuchAlgorithmException
| InvalidKeyException | BadPaddingException
......
package de.hdm_stuttgart.battlearena.Persistance.Classes;
import de.hdm_stuttgart.battlearena.Exceptions.CryptoException;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
......
package de.hdm_stuttgart.battlearena.Persistance.Classes;
import de.hdm_stuttgart.battlearena.Exceptions.CryptoException;
import de.hdm_stuttgart.battlearena.Exceptions.DatabaseError;
import java.sql.Connection;
......
package de.hdm_stuttgart.battlearena.Persistance.Classes;
import de.hdm_stuttgart.battlearena.Exceptions.CryptoException;
import de.hdm_stuttgart.battlearena.Exceptions.DatabaseError;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -17,7 +18,7 @@ public class OracleDB implements ISQLDataBase {
private static String password="";
private static String[] parts= new String[2];
static File encryptedFile = new File("src\\main\\resources\\database\\document.encrypted");
static File encryptedFile = new File("src\\main\\resources\\database\\OracleDB_logindetails");
//static File encryptedFile = new File("src\\main\\resources\\database\\document.encrypted");
//static File decryptedFile = new File("src\\main\\resources\\database\\document.decrypted");
......@@ -31,7 +32,7 @@ public class OracleDB implements ISQLDataBase {
}
@Override
public Connection connect() throws DatabaseError, CryptoException {
getlogindata();
//getlogindata();
try {
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=adb.eu-frankfurt-1.oraclecloud.com))(connect_data=(service_name=g093caf2cf1fea4_battlearena_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))");
......@@ -145,5 +146,5 @@ public class OracleDB implements ISQLDataBase {
//Update the commulative Stats
}
*/
}
......@@ -14,4 +14,5 @@ module gui {
exports de.hdm_stuttgart.battlearena.Main;
exports de.hdm_stuttgart.battlearena.Controller;
exports de.hdm_stuttgart.battlearena.Model.Multiplayer;
opens de.hdm_stuttgart.battlearena.Exceptions to com.google.gson;
}
z%\<$}6ж닛X,vsR|GDXzT~ٮ QI9A\3
\ No newline at end of file
z%\<$,wso
CwmZ\xf*:Nda?
\ No newline at end of file
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment