On Fri, Jul 4, 2008 at 3:13 PM, Viktor Balázs <[EMAIL PROTECTED]> wrote:
> How can I get client certification on MINA server? I'm using MINA 2.0.0-M1,
> and I created a server with SSL/TLS and I need the remote certification of
> connected clients. I found local (server) certification in SSLSessionImpl...

Here's how we do it in FtpServer. Note that in this case the method
lives in a subclass of IoSession, but you could of course do it from
anywhere you like as long as you call getFilterChain() on your
session.
    public Certificate[] getClientCertificates() {
        if(getFilterChain().contains("sslFilter")) {
            SslFilter sslFilter = (SslFilter) getFilterChain().get("sslFilter");

            SSLSession sslSession = sslFilter.getSslSession(this);

            if(sslSession != null) {
                try {
                    return sslSession.getPeerCertificates();
                } catch(SSLPeerUnverifiedException e) {
                    // ignore, certificate will not be available to the session
                }
            }

        }

        // no certificates available
        return null;

    }

/niklas

Reply via email to