Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Host never gets my certificate?.

Reply
Thread Tools

Host never gets my certificate?.

 
 
Will
Guest
Posts: n/a
 
      11-24-2003
It seems that I have scoured the net and came up empty
handed.

I have an ASP.net app that posts xml to another company's
servlet. For some transactions, they do not require a
certificate, but others do. I started building this app
with the transactions that did not require the cert, but
put in the code to use the cert anyhow. I have been
running for several months thinking that I was using my
cert, but now that I'm trying to build the transactions
that REQUIRE the cert- It turns out that the cert is not
ACTUALLY being used.

I called my contact at the other company and they say
their system never sees my cert being used.

I'm using what appears to be the 'standard' code that
eveyone else uses:
//################################################## ######
########
....Load XML
HttpWebRequest objRequest = (HttpWebRequest)
WebRequest.Create
("https://other.large.company.com/theirServlet");
objRequest.Method = "POST";
objRequest.ContentLength = xmlDoc.InnerXml.Length;
objRequest.ContentType = "text/xml";
objRequest.Timeout = 30000;
objRequest.ClientCertificates.Add
(X509Certificate.CreateFromCertFile
(Global.appPath+@"cert.cer"));
//
//ServicePointManager.CertificatePolicy = new CertPolicy
();
//
Response.Write
("certcount="+objRequest.ClientCertificates.Count. ToString
()+"<BR>");
....POST XML
....Get Response
....Process Response XML

ServicePoint sp = ServicePointManager.FindServicePoint
(objRequest.RequestUri);
if(sp.ClientCertificate!=null) Response.Write
("sp.ClientCertificate = "+sp.ClientCertificate.GetName()
+"<BR>");
else Response.Write("ClientCertificate is null<BR>");
if(sp.Certificate!=null) Response.Write("sp.Certificate
= "+sp.Certificate.ToString(true)+"<BR>");
else Response.Write("Certificate is null<BR>");
//################################################## ######
########

RESPONSE.WRITE OUTPUTS:
certcount=1
ClientCertificate is null
sp.Certificate = CERTIFICATE: Format: X509 Name: C=US,
S=Missouri, O=.....(edited out- this is the other
company's cert)


I've tried the "new CertPolicy()" route, but it doesn't
change anything. The Response.Write shows "certcount=1",
so it seems that it is loading it. I used GetName() on it
and it was the correct cert too. I'm not sure if
sp.Certificate sould have MY cert listed or theirs (as it
does).

The cert is installed on the server. I installed the
cert.pfx file and then exported it to cert.cer. In old
ASP, I had to use winhttpcertcfg.exe to give the
IWAM_COMPUTER user access to the cert, so I did this
again. But still nothing.
Oddly, the cert is under CURRENT_USER\MY where as before
it was under LOCAL_MACHINE\MY. Does this make a
difference?

I read somewhere that HttpWebRequest looks at the cert I
loaded, finds it in the store, and then uses it.
This is the only way for it to get the Private Key? Is
this true?
If so, then how do I know if it found it in the store? or
didn't?

How else can I possibly make a connection like
this!? .cer files don't have the Private Key. The Private
Key is required!

It is very hard to find the problem when there isn't any
kind of 'status' or monitoring of the actual connection
AND no errors. The other company just returns XML
saying "Basic authorization is not allowed for this
transaction".



-Hope someone can help!
-Will.K

..


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
You've never seen it before and you'll never see it again. Fred A Stover Computer Support 7 12-26-2007 03:33 AM
XML Schema never-never occurence of declared elements / attributes Soren Kuula XML 1 12-01-2005 01:27 PM
Host never gets my certificate? Will ASP .Net 0 11-19-2003 09:42 PM
string routines go to never never land on unix Kevin C Programming 4 10-17-2003 06:07 PM
Re: Win98 CD is NOT bootable! never was-never will be :-) Andrew Tang A+ Certification 0 07-05-2003 08:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57