diff --git a/api/build.gradle b/api/build.gradle index 0f14bf25..752a4b09 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -4,8 +4,6 @@ plugins { } dependencies { - implementation "org.bouncycastle:bcpkix-jdk15to18:1.66" - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9" implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0" diff --git a/api/src/main/kotlin/com/lhwdev/selfTestMacro/api/findUser.kt b/api/src/main/kotlin/com/lhwdev/selfTestMacro/api/findUser.kt index 1cb99967..b4261062 100644 --- a/api/src/main/kotlin/com/lhwdev/selfTestMacro/api/findUser.kt +++ b/api/src/main/kotlin/com/lhwdev/selfTestMacro/api/findUser.kt @@ -13,11 +13,9 @@ import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.Json import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive -import org.bouncycastle.jce.provider.BouncyCastleProvider import java.io.IOException import java.math.BigInteger import java.security.KeyFactory -import java.security.Security import java.security.spec.RSAPublicKeySpec import javax.crypto.Cipher @@ -68,17 +66,10 @@ suspend fun findUser(schoolInfo: SchoolInfo, request: GetUserTokenRequestBody) = lateinit var encodeBase64: (ByteArray) -> String -private val sProvider = run { - Security.removeProvider("BC") - val provider = BouncyCastleProvider() - Security.addProvider(provider) - provider -} - suspend fun encrypt(string: String): String = ioTask { val key = RSAPublicKeySpec(BigInteger("30718937712611605689191751047964347711554702318809238360089112453166217803395521606458190795722565177328746277011809492198037993902927400109154434682159584719442248913593972742086295960255192532052628569970645316811605886842040898815578676961759671712587342568414746446165948582657737331468733813122567503321355924190641302039446055143553127897636698729043365414410208454947672037202818029336707554263659582522814775377559532575089915217472518288660143323212695978110773753720635850393399040827859210693969622113812618481428838504301698541638186158736040620420633114291426890790215359085924554848097772407366395041461"), BigInteger("65537")) - val cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", sProvider) + val cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding") cipher.init(Cipher.PUBLIC_KEY, KeyFactory.getInstance("RSA").generatePublic(key)) encodeBase64(cipher.doFinal(string.toByteArray())) } diff --git a/app/build.gradle b/app/build.gradle index 510c04b6..44e32e7a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,8 +48,6 @@ android { dependencies { implementation project(":api") - implementation "androidx.multidex:multidex:2.0.1" - implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9" diff --git a/app/src/main/java/com/lhwdev/selfTestMacro/MainApplication.kt b/app/src/main/java/com/lhwdev/selfTestMacro/MainApplication.kt index 6fd5ce7b..02aa3a8f 100644 --- a/app/src/main/java/com/lhwdev/selfTestMacro/MainApplication.kt +++ b/app/src/main/java/com/lhwdev/selfTestMacro/MainApplication.kt @@ -1,10 +1,10 @@ package com.lhwdev.selfTestMacro -import androidx.multidex.MultiDexApplication +import android.app.Application @Suppress("unused") -class MainApplication : MultiDexApplication() { +class MainApplication : Application() { override fun onCreate() { super.onCreate() sDummyForInitialization