Home All Groups Group Topic Archive Search About

Access Private Key File From X509 Certificate

Author
1 Aug 2006 8:04 PM
drew.eugene
Hello-

I have a web service that uses a certificate to call another web
service.  When we install this web service on a new machine we often
get an error message stating the machine does not have access to the
Private Key.  To remedy this situation I am writing a small utility to
ensure the private key has appropriate rights.  However, I am finding
it difficult to retrieve the private key file based on an X509
Certificate in C#.

Does anyone know if it is possible, given an X509Certificate object to
find the windows file location of the private key corresponding to that
certificate, in C#?

Thanks!

Drew

Author
1 Aug 2006 10:34 PM
Dominick Baier
Hi,

there is a command line tool that can set the ACL

http://www.microsoft.com/downloads/details.aspx?familyid=C42E27AC-3409-40E9-8667-C748E422833F&displaylang=en

i also have source code that does the same programmatically...i can make
the source available when needed.

dominick

Show quoteHide quote
> Hello-
>
> I have a web service that uses a certificate to call another web
> service.  When we install this web service on a new machine we often
> get an error message stating the machine does not have access to the
> Private Key.  To remedy this situation I am writing a small utility to
> ensure the private key has appropriate rights.  However, I am finding
> it difficult to retrieve the private key file based on an X509
> Certificate in C#.
>
> Does anyone know if it is possible, given an X509Certificate object to
> find the windows file location of the private key corresponding to
> that certificate, in C#?
>
> Thanks!
>
> Drew
>
Author
2 Aug 2006 1:48 PM
drew.eugene
Hello Dominick -

Thanks for the reply.  That is exactly what I want to do, except I want
to do it myself in C#.  If you have source code (in any language) that
does the same thing, is there any way you could make that available?

Thanks!

Drew
Drew.Eug***@gmail.com


Dominick Baier wrote:
Show quoteHide quote
> Hi,
>
> there is a command line tool that can set the ACL
>
> http://www.microsoft.com/downloads/details.aspx?familyid=C42E27AC-3409-40E9-8667-C748E422833F&displaylang=en
>
> i also have source code that does the same programmatically...i can make
> the source available when needed.
>
> dominick
>
> > Hello-
> >
> > I have a web service that uses a certificate to call another web
> > service.  When we install this web service on a new machine we often
> > get an error message stating the machine does not have access to the
> > Private Key.  To remedy this situation I am writing a small utility to
> > ensure the private key has appropriate rights.  However, I am finding
> > it difficult to retrieve the private key file based on an X509
> > Certificate in C#.
> >
> > Does anyone know if it is possible, given an X509Certificate object to
> > find the windows file location of the private key corresponding to
> > that certificate, in C#?
> >
> > Thanks!
> >
> > Drew
> >
Author
2 Aug 2006 2:07 PM
Dominick Baier
yes :)

http://www.leastprivilege.com/HowToGetToThePrivateKeyFileFromACertificate.aspx

Show quoteHide quote
> Hello Dominick -
>
> Thanks for the reply.  That is exactly what I want to do, except I
> want to do it myself in C#.  If you have source code (in any language)
> that does the same thing, is there any way you could make that
> available?
>
> Thanks!
>
> Drew
> Drew.Eug***@gmail.com
> Dominick Baier wrote:
>
>> Hi,
>>
>> there is a command line tool that can set the ACL
>>
>> http://www.microsoft.com/downloads/details.aspx?familyid=C42E27AC-340
>> 9-40E9-8667-C748E422833F&displaylang=en
>>
>> i also have source code that does the same programmatically...i can
>> make the source available when needed.
>>
>> dominick
>>
>>> Hello-
>>>
>>> I have a web service that uses a certificate to call another web
>>> service.  When we install this web service on a new machine we often
>>> get an error message stating the machine does not have access to the
>>> Private Key.  To remedy this situation I am writing a small utility
>>> to ensure the private key has appropriate rights.  However, I am
>>> finding it difficult to retrieve the private key file based on an
>>> X509 Certificate in C#.
>>>
>>> Does anyone know if it is possible, given an X509Certificate object
>>> to find the windows file location of the private key corresponding
>>> to that certificate, in C#?
>>>
>>> Thanks!
>>>
>>> Drew
>>>
Author
2 Aug 2006 8:30 PM
drew.eugene
Thank you very much, this worked like a charm!

Drew

Dominick Baier wrote:
Show quoteHide quote
> yes :)
>
> http://www.leastprivilege.com/HowToGetToThePrivateKeyFileFromACertificate.aspx
>
> > Hello Dominick -
> >
> > Thanks for the reply.  That is exactly what I want to do, except I
> > want to do it myself in C#.  If you have source code (in any language)
> > that does the same thing, is there any way you could make that
> > available?
> >
> > Thanks!
> >
> > Drew
> > Drew.Eug***@gmail.com
> > Dominick Baier wrote:
> >
> >> Hi,
> >>
> >> there is a command line tool that can set the ACL
> >>
> >> http://www.microsoft.com/downloads/details.aspx?familyid=C42E27AC-340
> >> 9-40E9-8667-C748E422833F&displaylang=en
> >>
> >> i also have source code that does the same programmatically...i can
> >> make the source available when needed.
> >>
> >> dominick
> >>
> >>> Hello-
> >>>
> >>> I have a web service that uses a certificate to call another web
> >>> service.  When we install this web service on a new machine we often
> >>> get an error message stating the machine does not have access to the
> >>> Private Key.  To remedy this situation I am writing a small utility
> >>> to ensure the private key has appropriate rights.  However, I am
> >>> finding it difficult to retrieve the private key file based on an
> >>> X509 Certificate in C#.
> >>>
> >>> Does anyone know if it is possible, given an X509Certificate object
> >>> to find the windows file location of the private key corresponding
> >>> to that certificate, in C#?
> >>>
> >>> Thanks!
> >>>
> >>> Drew
> >>>