views:

63

answers:

1

The internet resources seem few and far between and the best MSDN page (as far as I could tell) throws an error!

Specifically, I'm not sure what to create as a CngKeyCreationParameters object...

Thanks,

Matt.

+2  A: 

CngKey : CngKey objects contain properties. Some properties must be added to a key when it is created. Other properties can be added after the key is created.

CngKeyCreationParameters: The CngKeyCreationParameters class enables you to add properties to a key as it is being created.

your problem: I'm not sure what to create as a CngKeyCreationParameters object

here is how to do do this


//  Create CngKeyCreationParameters 
CngKeyCreationParameters keyParams = new CngKeyCreationParameters();

// set properties accordingly
keyParams.ExportPolicy =  CngExportPolicies.AllowArchiving;
keyParams.KeyCreationOptions = CngKeyCreationOptions.MachineKey;
keyParams.Provider = new CngProvider("someprovider");

// here is how to use keyParams 
CngKey mycngKey =  
       CngKey.Create(new CngAlgorithm(""), "keyName", keyParams);
Asad Butt