net 与 corba 通讯进行ssl 通讯的问题

lihui_life 2018-04-28 04:55:01
如题,最近公司要对接一个corba接口,通过ior文件链接的corba 普通模式已经链接成功,但现在要改用ssl 模式 不知道怎么搞了,使用iiop.net 来搞得,有做过的大神,能贴下代码吗 谢谢了
...全文
979 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lihui_life 2018-05-02
  • 打赏
  • 举报
回复
引用 2 楼 daixf_csdn 的回复:
corba,好古老
很老的项目对接了。。。。
圣殿骑士18 2018-04-29
  • 打赏
  • 举报
回复
corba,好古老
lihui_life 2018-04-28
  • 打赏
  • 举报
回复
 [STAThread]
        public static void Main(string[] args) {
            try {
                Console.WriteLine("input the two summands");
                Console.WriteLine("sum1:");
                double sum1 = Double.Parse(Console.ReadLine());
                Console.WriteLine("sum2:");
                double sum2 = Double.Parse(Console.ReadLine());

                string fileName = @"..\server\ior";
                if (args.Length > 0) {
                    fileName = args[0];
                }
                TextReader reader = new StreamReader(fileName);
                string ior = reader.ReadLine();
                reader.Close();
                Console.WriteLine("use ior: " + ior.ToString());

                IDictionary props = new Hashtable();
                props[IiopChannel.CHANNEL_NAME_KEY] = "IiopClientChannelSsl";
                props[IiopChannel.TRANSPORT_FACTORY_KEY] =
                   "Ch.Elca.Iiop.Security.Ssl.SslTransportFactory,SSLPlugin";
            
                props[SslTransportFactory.CLIENT_AUTHENTICATION] = 
                    "Ch.Elca.Iiop.Security.Ssl.ClientMutualAuthenticationSuitableFromStore,SSLPlugin";
                // take certificates from the windows certificate store of the current user
                props[ClientMutualAuthenticationSuitableFromStore.STORE_LOCATION] =
                    "CurrentUser";
                // the expected CN property of the server key
                props[DefaultClientAuthenticationImpl.EXPECTED_SERVER_CERTIFICATE_CName] = 
                    "IIOP.NET demo server";
            
                // register the channel
                IiopClientChannel channel = new IiopClientChannel(props);
                ChannelServices.RegisterChannel(channel, false);

                // get the reference to the adder
                Adder adder = (Adder)RemotingServices.Connect(typeof(Adder), ior);
                // call add
                double result = adder.add(sum1, sum2);
                Console.WriteLine("result: " + result);
            } catch (Exception e) {
                Console.WriteLine("exception: " + e);
            }
        }
做过是在网上找到的demo,我也是仿照做的,普通模式的话 ok,但是 IiopClientChannel channel = new IiopClientChannel(props); 一旦加入 props 参数 就报错 :CORBA system exception : omg.org.CORBA.COMM_FAILURE, completed: Completed_MayBe minor: 209 在我本地 我只是改了以下参数 ,换成了自己的,是我换错了么? props[IiopChannel.CHANNEL_NAME_KEY] = "IiopClientChannelSsl"; // the expected CN property of the server key props[DefaultClientAuthenticationImpl.EXPECTED_SERVER_CERTIFICATE_CName] = "IIOP.NET demo server";

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧