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
@POST("api/v1/testApp/sign") | |
@Multipart | |
suspend fun sign( | |
@Part certFile: MultipartBody.Part, | |
@Part passwordFile: MultipartBody.Part, | |
@Part("data") data: RequestBody | |
): Response<CustomResponseModel> | |
private fun readPfxFileFromAssets(context: Context, fileName: String): ByteArray { |
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
import android.security.keystore.KeyGenParameterSpec | |
import android.security.keystore.KeyProperties | |
import java.nio.charset.StandardCharsets | |
import java.security.KeyPairGenerator | |
import java.security.KeyStore | |
import java.util.Base64 | |
import javax.crypto.Cipher | |
const val KEYSTORE_ALIAS = "apiKeys" | |
const val ANDROID_KEYSTORE = "AndroidKeyStore" |
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
const val PREF_NAME = "apiKeys" | |
const val PREF_DATA = "PREF_DATA" | |
class EncryptedPreferencesImpl(context: Context) : EncryptedPreferences { | |
private val masterKey = MasterKey.Builder(context) | |
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM) | |
.build() as? MasterKey | |
private val preferences = masterKey?.let { | |
EncryptedSharedPreferences.create( |