不知道你的Send 和Info具体是干嘛的,SSL是标准加密协议,一般情况下并不需要你另外写代码进行加密解密,只要配置好系统环境就可以了。
不过出现上面错误的原因一般是因为你的客户端keystore没有倒入服务端的证书。检查下你的keystore的内容就知道了。
c:\\test\\myKeystore

解决方案 »

  1.   

    我觉得好像不是证书出错得问题.
    因为,如果我单独象一台机器发送,那么没有问题.只有同时向两台机器发送数据,那么回出现问题.
     I use keytool to generate certificate, with the certificate,I can send data to one computer without any error.  Only when I send data to more than one computer ,such as two computer ,in the same time ,it will be error.may be when I send data to two computer the same time, then system initialized ,and catched the first certification content ,and when I send the data to other computer ,system still use the first certificate, so get a error say that “No trusted certificate found”. I don’t know is it for this reason.After I use System.setProperty("javax.net.debug","all"); I can see this Information:
    For first send will show :
    keyStore is : 
    keyStore type is : jks
    init keystore
    init keymanager of type SunX509
    trustStore is: c:\t\myKeystore
    trustStore type is : jks
    init truststore
    adding as trusted cert:
      Subject: CN=a, OU=b, O=c, L=d, ST=e, C=f
      Issuer:  CN=a, OU=b, O=c, L=d, ST=e, C=f
      Algorithm: RSA; Serial number: 0x40c67e6c
      Valid from Wed Jun 09 11:05:16 CST 2004 until Tue Sep 07 11:05:16 CST 2004init context
    trigger seeding of SecureRandom
    done seeding SecureRandombut when the second send  it will not be shown.
    Why ??
      

  2.   

    不知道你这个info.setCertificateKeyStore方法具体是怎么做的,
    其实你只要设2个系统参数即可:
    System.setProperty("javax.net.ssl.trustStore", "yourTrustStoreFileName");
    System.setProperty("javax.net.ssl.trustStorePassword", "yourTrustStorePassword");
    你把其他的代码去掉看看,只设这两个参数。
    奇怪,你一个客户端为甚么要用2个 keystore,只要用一个keystore然后倒入
    2个服务端的证书不是就可以了吗
      

  3.   

    The reason of error ,is that when connect two computer ,I use two deffrent certifications .
    I change it and use only one certification ,just copy one certification to two computer.it's ok!
    ---thanks very much!