Post not yet marked as solved
I have a financial app which should work only when a the registered phone number is there in device, so after login to app and if the user removes the SIM, the app should indicate that the app will conitnue to work only if that particular registered phone number(SIM) is there.
Post not yet marked as solved
AES 128 CBC algorithm is not producing same results compared to Android code. We have all static strings for key, iv and salt, even then the IV we couldnt match and produce same output as android.
This is the Android code,
object AESEncyption {
fun encrypt(strToEncrypt: String) : String?
{
try
{
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
val factory =
SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1")
val spec: KeySpec = PBEKeySpec(secretKey.toCharArray(), hex(salt), iterationCount, keySize)
val key: SecretKey = SecretKeySpec(factory.generateSecret(spec).encoded, "AES")
cipher.init(Cipher.ENCRYPT_MODE, key, IvParameterSpec(hex(iv)))
return base64(cipher.doFinal(strToEncrypt.toByteArray(Charsets.UTF_8)))
}
catch (e: Exception)
{
Log.i("Him","Error while encrypting: $e")
}
return null
}
private fun base64(bytes: ByteArray?): String {
return android.util.Base64.encodeToString(bytes, android.util.Base64.DEFAULT)
}
/* fun base64(str: String?): ByteArray? {
return Base64.decodeBase64(str)
}*/
fun hex(bytes: ByteArray?): String? {
return Hex.encodeHexString(bytes)
}
fun hex(str: String): ByteArray? {
return try {
Hex.decodeHex(str.toCharArray())
} catch (e: DecoderException) {
throw IllegalStateException(e)
}
}
}
iOS code is
let enc = try AES(key: keyVar2!.bytes, blockMode: CBC(iv: iv.base64FromHex.ivToUInt8Array), padding: .pkcs5).encrypt(value.bytes)
let encryptedData = Data(enc)
Post not yet marked as solved
How to uniquely identify the device to prevent fraudulent activity in any financial Apps? since UUID also gets changed on every installation, is there any option to track the device like how it is done with IMEI number ?
Note: Our App is targeted for normal Appstore users.