我尝试使用ObjectOutpuStream发送这个RSA自定义对象,我已经完成了Serializable . 为什么ObjectInputStream接收空指针并抛出异常NullPointer因为没有类成立

import java.io.Serializable;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.RSAKeyGenParameterSpec;
import javax.crypto.BadPaddingException;

import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;

public class NewRSA implements Serializable{

   private KeyPair keys ;


   public NewRSA(){
       this.keys=null;
   }
   public NewRSA(KeyPair keys)
   {
       this.keys=keys;
   }
    public KeyPair getKPair()
    {
        return keys;
    }
     public void setKPair(KeyPair keys)
    {
        this.keys=keys;
    }
  public  KeyPair generateRsaKeyPair(int keySize, BigInteger publicExponent)
  {

    try
    {
      KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
      RSAKeyGenParameterSpec spec = new RSAKeyGenParameterSpec(keySize, publicExponent);
      keyGen.initialize(spec);
      keys = keyGen.generateKeyPair();
    }
    catch(Exception e)
    {

    }
    return keys;
  }



    public  byte[] rsaEncrypt(byte[] original, PublicKey key) throws InvalidKeyException, IllegalBlockSizeException, NoSuchAlgorithmException, NoSuchPaddingException, BadPaddingException
  {


      Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
      cipher.init(Cipher.ENCRYPT_MODE, key);
      return cipher.doFinal(original);



  }


  public static byte[] rsaDecrypt(byte[] encrypted, PrivateKey key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
  {

      Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
      cipher.init(Cipher.DECRYPT_MODE, key);
      return cipher.doFinal(encrypted);


  }
}

错误是:没有classe

输出PrintStackTrace java.lang.ClassNotFoundException:com.android.org.conscrypt.OpenSSLRSAPrivateCrtKey at java.net.URLClassLoader.findClass(URLClassLoader.java:381)at java.lang.ClassLoader.loadClass(ClassLoader.java:424)at sun . misc.Launcher $ AppClassLoader.loadClass(Launcher.java:331)at java.lang.ClassLoader.loadClass(ClassLoader.java:357)at java.lang.Class.forName0(Native Method)at java.lang.Class.forName( java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)中的java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:626)中的Class.java:348 )at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774)at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)at stefano.Server在stefano.Server的stefano.Server $ ServerThread.handshake(Server.java:402)上的$ ServerThread.attemptLog(Server.java:268) $ ServerThread.run(Server.java:428)