I am currently finishing off an SSL plugin for IceCS (C#).
One of the things I would like to do is pass client certificate
information for a connection to the application, that is,
through Ice.Current.con().
Now, a generic way to do so would be to add an (opaque)
member to Connection, such as (in C# syntax):
This would also require to add the same kind of new memberCode:public interface _ConnectionOperationsNC { ... object info(); <-- new member }
to the Transceiver interface, and the method implemention
in the ConnectionI class would be:
My Transceiver implementation (SslTransceiver in this case)Code:public object info() { return _transceiver.info(); }
can then implement its info() method in any way it sees fit.
All the application needs to do is cast the object back
to a known type. Example (I modified the Hello server to
show the name on the client certificate):
Does that make sense to anyone?Code:public override void sayHello(Ice.Current current) { string msg = string.Empty; SslStream ssl = current.con.info() as SslStream; if (ssl != null) { X509Certificate cert = ssl.RemoteCertificate; msg = cert.Subject + " says: "; } msg += "Hello World!"; System.Console.Out.WriteLine(msg); }
Karl

Reply With Quote