Re: using p12 Certificate - converting to x509 What am I doing wrong?

From: news.microsoft.com (mike@kearl.net)
Date: 02/11/03


From: "news.microsoft.com" <mike@kearl.net>
Date: Mon, 10 Feb 2003 19:32:32 -0700


Well .looks like I wasted two weeks on p12 and trying to use this library
which I dont think the conversion works anyway. All I had to do was go to
the certificate manager export it to DES type. and use the built in
libraries. GRR

"news.microsoft.com" <mike@kearl.net> wrote in message
news:eEMQyLA0CHA.2288@TK2MSFTNGP09...
> I am trying to use a p12 certificate to access a secure site. I am using
> the library found at http://mentalis.org/soft/projects/certificates/
>
> I am loading in the certificate then converting it to a x509 cert. I am
> getting an error saying that a trusted relationship could not be
> established. What am I missing? is there something I have to do in order
> to acknowledge the certificate once I make the Web Request?? Any help or
> ideas would be greatly appreciated.
>
> this is my sourccode that I am using......
>
>
> this.req =
>
(HttpWebRequest)WebRequest.Create("https://test.transunionnetaccess.com:3018
> ?ping");
> try
> {
> //Loads the p12 certificate from the file
> Org.Mentalis.Security.Certificates.Certificate cert=
> Org.Mentalis.Security.Certificates.Certificate.CreateFromPfxFile(@"C:\TUNA
> Test Client Cert.p12","password");
> //Converts the p12 certificate to an x509 certificate.
>
> X509Certificate cert2 = cert.ToX509();
> WebClient c = new WebClient();
> this.req.ClientCertificates.Add(cert2);
> WebResponse result = req.GetResponse();
>
>
> Stream strm = result.GetResponseStream();
> byte[] buffer = new byte[1024];
> int len = 0;
> do
> {
> try
> {
> len = strm.Read(buffer, 0, 1024);
> this.textBox1.Text += System.Text.Encoding.ASCII.GetString(buffer, 0,
> len); }
> catch {}
> }
> while(len > 0); strm.Close();
> }
> catch (System.Exception ex)
> {
> Console.WriteLine(ex);
> }
>
>
>



Relevant Pages

  • Re: using p12 Certificate - converting to x509 What am I doing wrong?
    ... > libraries. ... >> I am trying to use a p12 certificate to access a secure site. ... >> I am loading in the certificate then converting it to a x509 cert. ...
    (microsoft.public.dotnet.security)
  • Re: Thomas Henderson b 1811-12 Knockin, Shropshire
    ... Adelaide, South Australia ... > Certificate,certificate,certificate. ... > As we are not aware of where you are, try State Libraries wherever ...
    (soc.genealogy.britain)
  • RE: Export p12 certificate
    ... p12 format. ... Certificate Export Wizard page, and then click Finish. ... Microsoft Online Newsgroup Support ... This newsgroup only focuses on SBS technical issues. ...
    (microsoft.public.windows.server.sbs)
  • Re: using p12 Certificate - converting to x509 What am I doing wrong?
    ... if I select the option not to export the private key. ... >> libraries. ... >>> getting an error saying that a trusted relationship could not be ... >>> to acknowledge the certificate once I make the Web Request?? ...
    (microsoft.public.dotnet.security)
  • Re: Password for certificate
    ... What I'm guessing is happening is that you supply the .cer file and .NET uses that to locate the matching certificate installed in the local store and then tries to access the private key in the local store to do the client auth but it does not use the password you supplied to access the key because that particular constructor is designed to use a stand alone p12 file and use the password to open it. ...
    (microsoft.public.dotnet.security)