I would like to know if there is a library or some way to encrypt information with Kotlin/JS, like the Cipher
class from javax.crypto
does
Exemple code Only working with Kotlin/JVM
RSAPublicKeySpec(mr.toBigInteger(16), er.toBigInteger(16)).let {
return Base64.getEncoder().encodeToString(Cipher.getInstance("RSA/ECB/PKCS1Padding")!!.apply {
init(Cipher.ENCRYPT_MODE, keyFactory.generatePublic(it))
}.doFinal(tempIv))
}
Variables
val mr =
"B99B77A3D72D3A29B4271FC7B7300E2F791EB8948174BE7B8024667E915446D4EEA0C2424B8D1EBF7E2DDFF94691C6E994E839225C627D140A8F1146D1B0B5F18A09BBD3D8F421CA1E3E4796B301EEBCCF80D81A32A1580121B8294433C38377083C5517D5921E8A078CDC019B15775292EFDA2C30251B1CCABE812386C893E5"
val er =
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001"