public override void Context() { base.Context(); keyLocation = dotNetPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Microsoft", "Crypto", "RSA", "MachineKeys"); groups = new List<string> { WellKnownSecurityRoles.Users }; PhysicalServer server =new DeploymentServer("localhost"); task = new GrantReadCertificatePrivateKeyTask(server,groups, thumbprint, StoreName.My, StoreLocation.LocalMachine, dotNetPath); certificate = BaseSecurityCertificatePermissionsTask.FindCertificateBy(thumbprint, StoreName.My, StoreLocation.LocalMachine, server,result); }
public override void RegisterRealTasks(PhysicalServer server) { var task = new GrantReadCertificatePrivateKeyTask(server,_groups, _thumbprint, _storeName, _storeLocation, _dotnetPath); server.AddTask(task); }
private static DeploymentResult GrantCertificatePermissions(string[] args) { var result = new DeploymentResult(); var perm = args[1]; var groupArray = args[2]; var thumbprint = args[3]; var storeNameArg = args[4]; var storeLocationArg = args[5]; var groups = groupArray.Split(new[]{"|"},StringSplitOptions.RemoveEmptyEntries); var storeName = (StoreName)Enum.Parse(typeof(StoreName), storeNameArg,true); var storeLocation = (StoreLocation)Enum.Parse(typeof(StoreLocation), storeLocationArg,true); switch (perm) { case "r": result = new GrantReadCertificatePrivateKeyTask(_server, groups, thumbprint, storeName, storeLocation, new DotNetPath()).Execute(); break; } return result; }