[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iaik-ssl] the SSLClient example



The error probably occurs at the line
X509Certificate[] certChain =
(iaik.x509.X509Certificate[])certificate.getCertificateChain();
in isTrustedPeer(). Because iSaSiLk is provider independent internally
the array is of type java.security.cert.X509Certificate[] and because of
the way casts work in Java the array cannot be cast to
iaik.x509.X509Certificate although each element could.

Something like this should work:
java.security.cert.X509Certificate[] certChainTmp =
certificate.getCertificateChain();
iaik.x509.X509Certificate[] certChain = new
iaik.x509.X509Certificate[certChainTmp.length];
System.arraycopy(certChainTmp, 0, certChain, 0, certChain.length);

PS: You can use exception.printStackTrace() to get more information about
where the exception occurs.

 Andreas Sterbenz              mailto:Andreas.Sterbenz@iaik.tu-graz.ac.at


-----Ursprüngliche Nachricht-----
Von: Conturbia Riccardo <s75918@dilbert.polito.it>
An: <iaik-ssl@iaik.tu-graz.ac.at>
Gesendet: Donnerstag, 15. Juli 1999 12:05
Betreff: [iaik-ssl] the SSLClient example


> Hi, I've tried to use your SSLClient example provided in the iSaSiLk
> documentation.
> I've made some minor changes in order to compile it.
> At runtime I have this ouptut:



smime.p7s