//DateTime expected in local time
 public static void GenerateSelfSignedCertAndImportToStore(string subName, string store, StoreLocation storeLocation, string DNS, DateTime expirationDate)
 {
     using (var pin = new PinCollection())
     {
         string profile;
         if (storeLocation == StoreLocation.CurrentUser)
         {
             profile = "U";
         }
         else
         {
             profile = "M";
         }
         NativeCommon.GenerateSelfSignedCertAndImportToStore(
             pin.AddBlittable(subName),
             pin.AddBlittable(store),
             pin.AddBlittable(profile),
             pin.AddBlittable(DNS),
             NativeTypes.ToNativeFILETIME(expirationDate));
     }
 }