public static void SetItemACL(string keyring, int id, ItemACL [] acls) { if (keyring == null) { throw new ArgumentNullException("keyring"); } if (acls == null) { throw new ArgumentNullException("acls"); } if (acls.Length == 0) { throw new ArgumentException("Empty ACL set.", "acls"); } RequestMessage req = new RequestMessage(); req.StartOperation(Operation.SetItemACL); req.Write(keyring); req.Write(id); req.Write(acls.Length); foreach (ItemACL acl in acls) { req.Write(acl.DisplayName); req.Write(acl.FullPath); req.Write((int)acl.Access); } req.EndOperation(); SendRequest(req.Stream); }
public static NetItemData [] FindNetworkPassword(string user, string domain, string server, string obj, string protocol, string authtype, int port) { RequestMessage req = new RequestMessage(); req.StartOperation(Operation.Find); req.Write((int)ItemType.NetworkPassword); Hashtable tbl = new Hashtable(); tbl ["user"] = user; tbl ["domain"] = domain; tbl ["server"] = server; tbl ["object"] = obj; tbl ["protocol"] = protocol; tbl ["authtype"] = authtype; if (port != 0) { tbl ["port"] = port; } req.WriteAttributes(tbl); req.EndOperation(); ResponseMessage resp = null; try { resp = SendRequest(req.Stream); } catch (KeyringException ke) { if (ke.ResultCode == ResultCode.Denied || ke.ResultCode == ResultCode.NoMatch) { return(empty_net_item_data); } throw; } ArrayList list = new ArrayList(); while (resp.DataAvailable) { NetItemData found = new NetItemData(); found.Keyring = resp.GetString(); found.ItemID = resp.GetInt32(); found.Secret = resp.GetString(); found.Attributes = new Hashtable(); resp.ReadAttributes(found.Attributes); found.SetValuesFromAttributes(); list.Add(found); } return((NetItemData [])list.ToArray(typeof(NetItemData))); }
public static void SetItemAttributes(string keyring, int id, Hashtable atts) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.StartOperation(Operation.SetItemAttributes); req.Write(keyring); req.Write(id); req.WriteAttributes(atts); req.EndOperation(); SendRequest(req.Stream); }
public static int CreateItem(string keyring, ItemType type, string displayName, Hashtable attributes, string secret, bool updateIfExists) { RequestMessage req = new RequestMessage(); req.StartOperation(Operation.CreateItem); req.Write(keyring); req.Write(displayName); req.Write(secret); req.WriteAttributes(attributes); req.Write((int)type); req.Write(updateIfExists ? 1 : 0); req.EndOperation(); ResponseMessage resp = SendRequest(req.Stream); return(resp.GetInt32()); }
public static void SetItemInfo(string keyring, int id, ItemType type, string displayName, string secret) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.StartOperation(Operation.SetItemInfo); req.Write(keyring); req.Write(id); req.Write((int)type); req.Write(displayName); req.Write(secret); req.EndOperation(); SendRequest(req.Stream); }
public static ItemData [] Find(ItemType type, Hashtable atts) { if (atts == null) { throw new ArgumentNullException("atts"); } RequestMessage req = new RequestMessage(); req.StartOperation(Operation.Find); req.Write((int)type); req.WriteAttributes(atts); req.EndOperation(); ResponseMessage resp = null; try { resp = SendRequest(req.Stream); } catch (KeyringException ke) { if (ke.ResultCode == ResultCode.Denied || ke.ResultCode == ResultCode.NoMatch) { return(empty_item_data); } throw; } ArrayList list = new ArrayList(); while (resp.DataAvailable) { ItemData found = ItemData.GetInstanceFromItemType(type); found.Keyring = resp.GetString(); found.ItemID = resp.GetInt32(); found.Secret = resp.GetString(); found.Attributes = new Hashtable(); resp.ReadAttributes(found.Attributes); found.SetValuesFromAttributes(); list.Add(found); } return((ItemData [])list.ToArray(typeof(ItemData))); }
public static void SetKeyringInfo(string keyring, KeyringInfo info) { if (keyring == null) { throw new ArgumentNullException("keyring"); } if (info == null) { throw new ArgumentNullException("info"); } RequestMessage req = new RequestMessage(); req.StartOperation(Operation.SetKeyringInfo); req.Write(keyring); req.Write(info.LockOnIdle ? 1 : 0); req.Write(info.LockTimeoutSeconds); req.EndOperation(); SendRequest(req.Stream); }
public static void SetItemACL (string keyring, int id, ItemACL [] acls) { if (keyring == null) throw new ArgumentNullException ("keyring"); if (acls == null) throw new ArgumentNullException ("acls"); if (acls.Length == 0) throw new ArgumentException ("Empty ACL set.", "acls"); RequestMessage req = new RequestMessage (); req.StartOperation (Operation.SetItemACL); req.Write (keyring); req.Write (id); req.Write (acls.Length); foreach (ItemACL acl in acls) { req.Write (acl.DisplayName); req.Write (acl.FullPath); req.Write ((int) acl.Access); } req.EndOperation (); SendRequest (req.Stream); }
public static void SetKeyringInfo (string keyring, KeyringInfo info) { if (keyring == null) throw new ArgumentNullException ("keyring"); if (info == null) throw new ArgumentNullException ("info"); RequestMessage req = new RequestMessage (); req.StartOperation (Operation.SetKeyringInfo); req.Write (keyring); req.Write (info.LockOnIdle ? 1 : 0); req.Write (info.LockTimeoutSeconds); req.EndOperation (); SendRequest (req.Stream); }
public static void SetItemAttributes (string keyring, int id, Hashtable atts) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.StartOperation (Operation.SetItemAttributes); req.Write (keyring); req.Write (id); req.WriteAttributes (atts); req.EndOperation (); SendRequest (req.Stream); }
public static void SetItemInfo (string keyring, int id, ItemType type, string displayName, string secret) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.StartOperation (Operation.SetItemInfo); req.Write (keyring); req.Write (id); req.Write ((int) type); req.Write (displayName); req.Write (secret); req.EndOperation (); SendRequest (req.Stream); }
public static int CreateItem (string keyring, ItemType type, string displayName, Hashtable attributes, string secret, bool updateIfExists) { RequestMessage req = new RequestMessage (); req.StartOperation (Operation.CreateItem); req.Write (keyring); req.Write (displayName); req.Write (secret); req.WriteAttributes (attributes); req.Write ((int) type); req.Write (updateIfExists ? 1 : 0); req.EndOperation (); ResponseMessage resp = SendRequest (req.Stream); return resp.GetInt32 (); }
public static NetItemData [] FindNetworkPassword (string user, string domain, string server, string obj, string protocol, string authtype, int port) { RequestMessage req = new RequestMessage (); req.StartOperation (Operation.Find); req.Write ((int) ItemType.NetworkPassword); Hashtable tbl = new Hashtable (); tbl ["user"] = user; tbl ["domain"] = domain; tbl ["server"] = server; tbl ["object"] = obj; tbl ["protocol"] = protocol; tbl ["authtype"] = authtype; if (port != 0) tbl ["port"] = port; req.WriteAttributes (tbl); req.EndOperation (); ResponseMessage resp = null; try { resp = SendRequest (req.Stream); } catch (KeyringException ke) { if (ke.ResultCode == ResultCode.Denied || ke.ResultCode == ResultCode.NoMatch) return empty_net_item_data; throw; } ArrayList list = new ArrayList (); while (resp.DataAvailable) { NetItemData found = new NetItemData (); found.Keyring = resp.GetString (); found.ItemID = resp.GetInt32 (); found.Secret = resp.GetString (); found.Attributes = new Hashtable (); resp.ReadAttributes (found.Attributes); found.SetValuesFromAttributes (); list.Add (found); } return (NetItemData []) list.ToArray (typeof (NetItemData)); }
public static ItemData [] Find (ItemType type, Hashtable atts) { if (atts == null) throw new ArgumentNullException ("atts"); RequestMessage req = new RequestMessage (); req.StartOperation (Operation.Find); req.Write ((int) type); req.WriteAttributes (atts); req.EndOperation (); ResponseMessage resp = null; try { resp = SendRequest (req.Stream); } catch (KeyringException ke) { if (ke.ResultCode == ResultCode.Denied || ke.ResultCode == ResultCode.NoMatch) return empty_item_data; throw; } ArrayList list = new ArrayList (); while (resp.DataAvailable) { ItemData found = ItemData.GetInstanceFromItemType (type); found.Keyring = resp.GetString (); found.ItemID = resp.GetInt32 (); found.Secret = resp.GetString (); found.Attributes = new Hashtable (); resp.ReadAttributes (found.Attributes); found.SetValuesFromAttributes (); list.Add (found); } return (ItemData []) list.ToArray (typeof (ItemData)); }