You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/DbHandler.java
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -13,16 +13,18 @@
13
13
* Methods for handling backend of database operations
14
14
* Creates necessary tables on startup of system
15
15
* @author Yash Shinde
16
-
*/
16
+
* @version 1.1.0
17
+
*/
17
18
18
19
publicclassDbHandler {
19
20
protectedstaticfinalStringDB_URL = "jdbc:sqlite:unified.db"; //Database URL , name : unified.db
20
21
privatestaticfinalStringCREATE_USERDATA_TABLE_SQL = "CREATE TABLE IF NOT EXISTS userdata (id INTEGER PRIMARY KEY AUTOINCREMENT ,username TEXT NOT NULL UNIQUE , password TEXT NOT NULL, Last_Login TEXT)";
21
22
privatestaticfinalStringCREATE_FILES_TABLE_SQL = "CREATE TABLE IF NOT EXISTS files(id INTEGER PRIMARY KEY AUTOINCREMENT,filename TEXT NOT NULL,filedata BLOB NOT NULL,username TEXT NOT NULL, isEncrypted INTEGER NOT NULL DEFAULT 0)";
22
-
privatestaticfinalStringCREATE_KEYS_TABLE_SQL = "CREATE TABLE IF NOT EXISTS keys (keyId INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER, username TEXT NOT NULL , filename TEXT NOT NULL, key TEXT NOT NULL,IniVec VARBINARY(16) NOT NULL,FOREIGN KEY (id) REFERENCES files(id) ON DELETE CASCADE,FOREIGN KEY (username) REFERENCES userdata(username) ON DELETE CASCADE)";
23
+
privatestaticfinalStringCREATE_KEYS_TABLE_SQL = "CREATE TABLE IF NOT EXISTS keys (keyId INTEGER PRIMARY KEY AUTOINCREMENT,id INTEGER, username TEXT NOT NULL , filename TEXT NOT NULL, key TEXT NOT NULL,IniVec TEXT NOT NULL,FOREIGN KEY (id) REFERENCES files(id) ON DELETE CASCADE,FOREIGN KEY (username) REFERENCES userdata(username) ON DELETE CASCADE)";
23
24
privatestaticfinalStringCREATE_ADMIN_DATA_TABLE_SQL = "CREATE TABLE IF NOT EXISTS Admindata (id INTEGER PRIMARY KEY AUTOINCREMENT ,AdminName TEXT NOT NULL UNIQUE , password TEXT NOT NULL, Last_Login TEXT)";
25
+
24
26
staticvoidsetupDatabase() {
25
-
27
+
//Initializes all tables and adds default admin if no admins exist
+"AES 256 : Symmetric encryption of files with any extension type , files can be stored on embedded database or local directory based on size ,\ngenerates secure random key and initialization vector.\n\n"
146
+
+"NEW! : Custom AES Decryption CBC+ECB\n\n"+"AES 256 : Symmetric encryption of files with any extension type , files can be stored on embedded database or local directory based on size ,\ngenerates secure random key and initialization vector.\n\n"
147
147
+"SHA File Checksum : Generates SHA256/512 hash for a file.\n\n"+
148
148
"File Database Backup : Encodes file data and stores directly on embedded database without encryption.\n\n"
149
149
+"Admin login : For directly manipulating database with predefined tools (Default ID,Password : (Admin,Admin) , can be updated).\n\n"
150
150
+"User login : Credentials are hashed and stored securely.\n\n");});
151
151
152
152
/*User login , default Admin is created at startup
153
-
*creadentials for Admin can be changed in program aswell as in source (DbHandler.java)
153
+
*credentials for Admin can be changed in program as well as in source (DbHandler.java)
0 commit comments