Hello,
I'm creating a Client-Server Chat Application. They are communicating over Sockets. The Server and the Android Client are written in Kotlin.
Now to my question. When the Client is opened it generetes a RSA KeyPair. When the Client wants to log in on the Server it sends it's own public Key to the Server for encryption. Here my code for building the KeyPair:
object Keys {
var publicKeyServer: PublicKey? = null
private val keyPair = buildKeyPair()
val privateKey: PrivateKey = keyPair.private
val publicKey: PublicKey = keyPair.public
private fun buildKeyPair(): KeyPair {
val keyPairGenerator = KeyPairGenerator.getInstance("RSA")
keyPairGenerator.initialize(2048)
return keyPairGenerator.genKeyPair()
}
}
Alles anzeigen
The Public Key is send in a MessageObject. Now when reading the Object from the ObjectInputStream I'm getting a ClassNotFoundException:
java.lang.ClassNotFoundException: com.android.org.conscrypt.OpenSSLRSAPublicKey
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:686)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1866)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2040)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
at java.io.ObjectInputStream.readUnshared(ObjectInputStream.java:521)
at server.ClientThread.run(ClientThread.kt:67)
I can't figure out why the Server is looking for the Class OpenSSLRSAPublicKey. I don't use it anywhere. Is conscrypt Androids Security Provider?
I would appreciate your help.
Thanks in advance
Ludtwigk