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

Re: [iaik-ssl] the SSLClient example



Andreas Sterbenz wrote:
> 
> 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

Thank you very much! Now It's working, actually I'm using
iaik.java.security.cert.X509Certificate, instead of
iaik.x509.X509Certificate and with some other minor changes everything
is OK...

Riccardo Conturbia
--
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-ssl/maillist.html

To unsubscribe send an email to listserv@iaik.tu-graz.ac.at with the folowing content: UNSUBSCRIBE iaik-ssl