المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Add extension to X509Certificate



C# Programming
09-17-2009, 03:00 AM
Hi,
I need to add x509Extension to x509Certificate2 class but i dont know how (i read somewhere its not possible so im not sure about it).
Lets imagine this code :

X509Certificate2 cert;
X509Extension ext;

cert.Extensions.Add (ext); // since here its ok i can see the collection in debug mode and it is present.

byte [] b = cert.export (X509contentType.Cert);
X509Certificate2 cert2 = new X509Certificate2 (b);

// Here comes the problem ... there is no my extension in the cert2 collection.

Btw: I create it by calling c function CertCreateSelfSignCertficate. Is there any way to add my extension to created certificate or the only way to add it is in the creation time?

i rack my brain with this issue for several days so any help would be very appreciated.

thanks
Libor