Re: How do we get the private key to do digital signature?



On Apr 9, 7:44 pm, "Mitch Gallant" <jensig...@xxxxxxxxxxxxxxxx> wrote:

OK first of all, I'll reiterate that I have been able to do this from a
standalone .NET 1.1 client using basic code like this:
--------- .NET 1.1 snippet to connect to SSL server requiring
client-certificate authentication -----
X509Certificate jscert = X509Certificate.CreateFromCertFile(certfile);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.ClientCertificates.Add(jscert);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
------------------------
and with .NET 2, you can use all the support for searching and finding
certificates (so you wouldn't need to use CAPICOM from .NET).

I think that you could use the WinHttpRequest COM object like so:

---VBScriptsample to connect to SSL server requiring client-cert
authentication --------
.....
Dim HttpReq As Object
' Instantiate the WinHTTPRequest ActiveX Object.
Set HttpReq = New WinHttpRequest

' Open an HTTP connection.
HttpReq.Open "GET", "https://somesecureurl/";, False

'Select a client certificate.
HttpReq.SetClientCertificate "LOCAL_MACHINE\Personal\My Middle-Tier
Certificate"

' Send the HTTP Request.
HttpReq.Send
-----------------------

check out MSDN docs on WinHttpRequest COM object (part of Windows HTTP
Services) at:http://msdn2.microsoft.com/en-us/library/aa384106.aspx

- Mitch-

Thank you so much. My web application is developed in Java and runs
on Tomcat 6.0. So, I won't be able to use the .Net technology. That
said, I am interested in your vbs sample.

In your vbs sample, you have:

'Select a client certificate.
HttpReq.SetClientCertificate "LOCAL_MACHINE\Personal\My Middle-Tier
Certificate"

This sample code is also available at
http://msdn2.microsoft.com/en-us/library/aa384055.aspx

Unfortunately, these snippets of code over there all presuppose that
the vbs programmer knows which client certificate to use.

But, in my case, I do not know which certificate is selected unless I
can poll the IE popup dialog box through some API after the user
clicks "OK".

Am I following?

.



Relevant Pages


Quantcast