Skip to content

Commit

Permalink
Setup encrypt/decrypt method to be compatible with Java
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsiogas4 committed May 29, 2019
1 parent 51771bf commit 8f4901d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions securebox/src/main/java/ptsiogas/gr/securebox/SecureBoxHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ptsiogas.gr.securebox

import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.provider.Settings
import android.util.Log
import java.io.File
Expand All @@ -15,9 +14,6 @@ import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.PBEKeySpec
import javax.crypto.spec.SecretKeySpec
import java.io.ObjectOutputStream
import android.provider.Settings.Secure



class SecureBoxHelper {
companion object {
Expand Down Expand Up @@ -47,7 +43,11 @@ class SecureBoxHelper {
return true
}

fun encryptString(variableName: String, plainText: String, passwordString: String = getSecureId()): Boolean {
fun encryptString(variableName: String, plainText: String): Boolean {
return encryptString(variableName, plainText, getSecureId())
}

fun encryptString(variableName: String, plainText: String, passwordString: String): Boolean {
if (!checkInit()) {
return false
}
Expand All @@ -66,7 +66,11 @@ class SecureBoxHelper {
return false
}

fun decryptString(variableName: String, passwordString: String = getSecureId()): String? {
fun decryptString(variableName: String): String? {
return decryptString(variableName, getSecureId())
}

fun decryptString(variableName: String, passwordString: String): String? {
if (!checkInit()) {
return null
}
Expand Down

0 comments on commit 8f4901d

Please sign in to comment.