-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* release-2.5.9: (24 commits) Update versionCode and versionName Update translations from POEditor Add Russian translation from POEditor Fix incorrect hourly schedules for the second day day after schedule creation Allow hourly repetition schedules every 5 and 10 hours Update gradle plugin and kotlin versions to 3.2.1 and 1.2.71 CI: use api 28 image to avoid re-download of build-tools Add 5 min delay option ids.xml: Remove inner values Update Gradle plugin and Gradle versions to 3.2.0 and 4.6 build.gradle: Make global buildscript dependency versions ext variables build.gradle: Update Kotlin version to 1.2.70 build.gradle: substitute library version repetitions for ext variables build.gradle: Don't specify buildToolsVersion build: use 'implementation' instead of 'compile' for secure preference dependency PreferenceUtils: add missing apply() Initialize default preferences on application startup Add secure window preference EncryptionProvider: ditch GSON serialization for simpler base64 encoding Refactor security classes ...
- Loading branch information
Showing
30 changed files
with
1,041 additions
and
95 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
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
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
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
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
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
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
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
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
75 changes: 75 additions & 0 deletions
75
...a/es/usc/citius/servando/calendula/persistence/typeSerializers/SecureStringPersister.java
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,75 @@ | ||
/* | ||
* Calendula - An assistant for personal medication management. | ||
* Copyright (C) 2016 CITIUS - USC | ||
* | ||
* Calendula is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this software. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package es.usc.citius.servando.calendula.persistence.typeSerializers; | ||
|
||
import com.j256.ormlite.field.FieldType; | ||
import com.j256.ormlite.field.SqlType; | ||
import com.j256.ormlite.field.types.BaseDataType; | ||
import com.j256.ormlite.support.DatabaseResults; | ||
|
||
import java.nio.charset.Charset; | ||
import java.sql.SQLException; | ||
|
||
import es.usc.citius.servando.calendula.util.security.SecurityProvider; | ||
|
||
public class SecureStringPersister extends BaseDataType { | ||
|
||
private static final SecureStringPersister singleton = new SecureStringPersister(); | ||
private static Charset UTF8 = Charset.forName("UTF-8"); | ||
|
||
public SecureStringPersister() { | ||
super(SqlType.STRING, new Class<?>[]{String.class}); | ||
} | ||
|
||
public static SecureStringPersister getSingleton() { | ||
return singleton; | ||
} | ||
|
||
@Override | ||
public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { | ||
return defaultStr; | ||
} | ||
|
||
@Override | ||
public Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos) throws SQLException { | ||
return results.getString(columnPos); | ||
} | ||
|
||
@Override | ||
public Object sqlArgToJava(FieldType fieldType, Object sqlArg, int columnPos) throws SQLException { | ||
if (sqlArg == null) { | ||
return null; | ||
} | ||
if (((String) sqlArg).isEmpty()) { | ||
return ""; | ||
} | ||
return SecurityProvider.getEncryptionProvider().decrypt((String) sqlArg); | ||
} | ||
|
||
@Override | ||
public Object javaToSqlArg(FieldType fieldType, Object javaObject) throws SQLException { | ||
if (javaObject == null) { | ||
return null; | ||
} | ||
if (((String) javaObject).isEmpty()) { | ||
return ""; | ||
} | ||
return SecurityProvider.getEncryptionProvider().encrypt((String) javaObject); | ||
} | ||
} |
Oops, something went wrong.