views:

11

answers:

0

hey there.. I'm trying to create a CngKey object using the X509Certificate2.GetPublicKey() method.

i tried:

        X509Certificate2 cert = new X509Certificate2(@"C:\Temp\cert.cer");
        byte[] certPublicKey = cert.GetPublicKey();

        CngKey key = CngKey.Import(certPublicKey, CngKeyBlobFormat.GenericPublicBlob);

an internal exception was thrown

please, help =] thanks, jossef