对方给的实例都是java的,网上资料很少。

解决方案 »

  1.   

    你可以看看这个,http://q.cnblogs.com/q/54288/
      

  2.   

    谢谢楼上,一般证书是pfx格式的,但是他提供的是truststore后缀的。没有遇到过。有了解的大侠吗?
      

  3.   

    同求啊,使用X509Certificate cert = new X509Certificate(path, psw, X509KeyStorageFlags.MachineKeySet);
    这样获取,就报错,
    未处理System.Security.Cryptography.CryptographicException
      Message=找不到申请的对象。  Source=mscorlib
      StackTrace:
           在 System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
           在 System.Security.Cryptography.X509Certificates.X509Utils._QueryCertFileType(String fileName)
           在 System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags)
           在 System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
           在 UnionMallSync.ICBC.ICBCApi.DoGet(String posdata) 位置 d:\EricSource\TIGER\Eshop2010.root\UnionMall\Projects\UnionMallSync\ICBC\ICBCApi.cs:行号 151
           在 UnionMallSync.ICBC.ICBCApi.apiclick(String method, String data) 位置 d:\EricSource\TIGER\Eshop2010.root\UnionMall\Projects\UnionMallSync\ICBC\ICBCApi.cs:行号 130
           在 UnionMallSync.ICBC.ICBCOrder.test() 位置 d:\EricSource\TIGER\Eshop2010.root\UnionMall\Projects\UnionMallSync\ICBC\ICBCOrder.cs:行号 101
           在 UnionMallPRO.test.button205_Click(Object sender, EventArgs e) 位置 d:\EricSource\TIGER\Eshop2010.root\UnionMall\Projects\UnionMallPRO\test.cs:行号 2398
           在 System.Windows.Forms.Control.OnClick(EventArgs e)
           在 System.Windows.Forms.Button.OnClick(EventArgs e)
           在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           在 System.Windows.Forms.Control.WndProc(Message& m)
           在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
           在 System.Windows.Forms.Button.WndProc(Message& m)
           在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.Run(Form mainForm)
           在 UnionMallPRO.Program.Main() 位置 d:\EricSource\TIGER\Eshop2010.root\UnionMall\Projects\UnionMallPRO\Program.cs:行号 17
           在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           在 System.Threading.ThreadHelper.ThreadStart()
      InnerException: 
      

  4.   

    我的证书的后缀与你的一样,我昨天又问工行的人,他们的证书是什么格式,他说是PFX格式,我在怀疑他是否给错证书了
    ,这个 truststore后缀的证书是证书仓库,一般是放在tomcar里面,由tomcar读取的!