Skip to content

Commit

Permalink
chore: remove description in native code
Browse files Browse the repository at this point in the history
  • Loading branch information
ko-devHong committed May 2, 2024
1 parent 53a4963 commit 6a83cc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 5 additions & 5 deletions android/src/main/java/com/cryptorsa/CryptoRsa.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class CryptoRsa(originReactContext: ReactApplicationContext, originKeySize:Int?)
val keyStore = KeyStore.getInstance(KEY_STORE_TYPE)
keyStore.load(null)

// if (keyStore.containsAlias(PRIVATE_KEY_ALIAS)) {
// keyStore.deleteEntry(PRIVATE_KEY_ALIAS);
// }
if (keyStore.containsAlias(PRIVATE_KEY_ALIAS)) {
keyStore.deleteEntry(PRIVATE_KEY_ALIAS);
}
return keyStore
}
private fun getEncryptedSharedPreferences(): SharedPreferences {
Expand Down Expand Up @@ -249,8 +249,8 @@ class CryptoRsa(originReactContext: ReactApplicationContext, originKeySize:Int?)
fun decrypt(encryptedDataString: String): String? {
val decryptedData = Base64.decode(encryptedDataString,Base64.DEFAULT)
val privateKey = getPrivateKey() ?: return null
Log.w(TAG,"decrypt privateKey : $privateKey")
Log.w(TAG,"decrypt decryptedData : $decryptedData")
Log.d(TAG,"decrypt privateKey : $privateKey")
Log.d(TAG,"decrypt decryptedData : $decryptedData")
val cipher = getCipher()
cipher.init(Cipher.DECRYPT_MODE, privateKey)
return String(cipher.doFinal(decryptedData), Charsets.UTF_8)
Expand Down
3 changes: 0 additions & 3 deletions android/src/main/java/com/cryptorsa/CryptoRsaModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,20 @@ class CryptoRsaModule(reactContext: ReactApplicationContext) :
runBlocking {
launch { promise.resolve(cryptoRsa.privateKeyToPemString(cryptoRsa.getPrivateKey()!!)) }
}
// decrypt https://stackoverflow.com/questions/22900570/key-from-string-in-java-rsa
}

@ReactMethod
fun getPublicKey(promise: Promise) {
runBlocking {
launch { promise.resolve(cryptoRsa.publicKeyToPemString(cryptoRsa.getPublicKey()!!)) }
}
// decrypt https://stackoverflow.com/questions/22900570/key-from-string-in-java-rsa
}

@ReactMethod
fun getSHA512Text(pemString: String,promise: Promise) {
runBlocking {
launch { promise.resolve(cryptoRsa.getSha512Text(pemString)) }
}
// decrypt https://stackoverflow.com/questions/22900570/key-from-string-in-java-rsa
}

@RequiresApi(Build.VERSION_CODES.M)
Expand Down

0 comments on commit 6a83cc6

Please sign in to comment.