News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
Can't touch the Certificate.PublicKey property  
by Hans Jörgensen
posted on 2003/11/11

Hi,

I met problems when I impersonate the ASP.NET application with a row in a web.config:

<identity impersonate="true" />

This should impersonate the application to logged user account that is administrator in this case.


If I do this I cant instantiate a Certficate object so that the public key wouldn't be invalid or un touchable. In debugger I see that the PublicKey property has rised an exception.

If I don't impersonate the application, everything goes fine.

What can cause this situation ? Does anybody have a clue ?

my code:

Certificate RSAcert = Certificate.CreateFromCerFile("C:\\client.cer");
RSAcert.AssociateWithPrivateKey("C:\\client.pvk", "test", true);
Debug.WriteLine("pub key: "+RSAcert.GetPublicKeyString()); // this gives always a nice public key string
RSAPKCS1SignatureDeformatter RSADeformatter = new RSAPKCS1SignatureDeformatter(RSAcert.PublicKey); // this makes things to hang

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2003/11/12

What kind of exception are you getting? What's the message of that exception? What's the stack trace?

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.