public static ItemData GetItemInfo(string keyring, int id) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.GetItemInfo, keyring, id); ResponseMessage resp = SendRequest(req.Stream); ItemType itype = (ItemType)resp.GetInt32(); ItemData item = ItemData.GetInstanceFromItemType(itype); string name = resp.GetString(); string secret = resp.GetString(); DateTime mtime = resp.GetDateTime(); DateTime ctime = resp.GetDateTime(); item.Keyring = keyring; item.ItemID = id; item.Secret = secret; Hashtable tbl = new Hashtable(); tbl ["name"] = name; tbl ["keyring_ctime"] = ctime; tbl ["keyring_mtime"] = mtime; item.Attributes = tbl; item.SetValuesFromAttributes(); return(item); }
public static void CreateKeyring(string name, string password) { RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.CreateKeyring, name, password); SendRequest(req.Stream); }
public static void LockAll() { RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.LockAll); SendRequest(req.Stream); }
public static string [] GetKeyrings() { RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.ListKeyrings); ResponseMessage resp = SendRequest(req.Stream); return(resp.GetStringList()); }
public static string GetDefaultKeyring() { RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.GetDefaultKeyring); ResponseMessage resp = SendRequest(req.Stream); return(resp.GetString()); }
public static void SetDefaultKeyring(string newKeyring) { if (newKeyring == null) { throw new ArgumentNullException("newKeyring"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.SetDefaultKeyring, newKeyring); SendRequest(req.Stream); }
public static void DeleteItem(string keyring, int id) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.DeleteItem, keyring, id); SendRequest(req.Stream); }
public static void Lock(string keyring) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.LockKeyring, keyring); SendRequest(req.Stream); }
public static Hashtable GetItemAttributes(string keyring, int id) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.GetItemAttributes, keyring, id); ResponseMessage resp = SendRequest(req.Stream); Hashtable tbl = new Hashtable(); resp.ReadAttributes(tbl); return(tbl); }
public static KeyringInfo GetKeyringInfo(string keyring) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.GetKeyringInfo, keyring); ResponseMessage resp = SendRequest(req.Stream); return(new KeyringInfo(keyring, (resp.GetInt32() != 0), resp.GetInt32(), resp.GetDateTime(), resp.GetDateTime(), (resp.GetInt32() != 0))); }
public static ArrayList GetItemACL(string keyring, int id) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.GetItemACL, keyring, id); ResponseMessage resp = SendRequest(req.Stream); int count = resp.GetInt32(); ArrayList list = new ArrayList(count); for (int i = 0; i < count; i++) { list.Add(new ItemACL(resp.GetString(), resp.GetString(), (AccessRights)resp.GetInt32())); } return(list); }
public static int [] ListItemIDs(string keyring) { if (keyring == null) { throw new ArgumentNullException("keyring"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.ListItems, keyring); ResponseMessage resp = SendRequest(req.Stream); int len = resp.GetInt32(); int [] result = new int [len]; for (int i = 0; i < len; i++) { result [i] = resp.GetInt32(); } return(result); }
public static void Unlock(string keyring, string password) { if (keyring == null) { throw new ArgumentNullException("keyring"); } if (password == null) { throw new ArgumentNullException("password"); } RequestMessage req = new RequestMessage(); req.CreateSimpleOperation(Operation.UnlockKeyring, keyring, password); try { SendRequest(req.Stream); } catch (KeyringException ke) { if (ke.ResultCode != ResultCode.AlreadyUnlocked) { throw; } } }
public static Hashtable GetItemAttributes (string keyring, int id) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.GetItemAttributes, keyring, id); ResponseMessage resp = SendRequest (req.Stream); Hashtable tbl = new Hashtable (); resp.ReadAttributes (tbl); return tbl; }
public static ItemData GetItemInfo (string keyring, int id) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.GetItemInfo, keyring, id); ResponseMessage resp = SendRequest (req.Stream); ItemType itype = (ItemType) resp.GetInt32 (); ItemData item = ItemData.GetInstanceFromItemType (itype); string name = resp.GetString (); string secret = resp.GetString (); DateTime mtime = resp.GetDateTime (); DateTime ctime = resp.GetDateTime (); item.Keyring = keyring; item.ItemID = id; item.Secret = secret; Hashtable tbl = new Hashtable (); tbl ["name"] = name; tbl ["keyring_ctime"] = ctime; tbl ["keyring_mtime"] = mtime; item.Attributes = tbl; item.SetValuesFromAttributes (); return item; }
public static void DeleteItem (string keyring, int id) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.DeleteItem, keyring, id); SendRequest (req.Stream); }
public static int [] ListItemIDs (string keyring) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.ListItems, keyring); ResponseMessage resp = SendRequest (req.Stream); int len = resp.GetInt32 (); int [] result = new int [len]; for (int i = 0; i < len; i++) { result [i] = resp.GetInt32 (); } return result; }
public static void Unlock (string keyring, string password) { if (keyring == null) throw new ArgumentNullException ("keyring"); if (password == null) throw new ArgumentNullException ("password"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.UnlockKeyring, keyring, password); try { SendRequest (req.Stream); } catch (KeyringException ke) { if (ke.ResultCode != ResultCode.AlreadyUnlocked) throw; } }
public static void Lock (string keyring) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.LockKeyring, keyring); SendRequest (req.Stream); }
public static void CreateKeyring (string name, string password) { RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.CreateKeyring, name, password); SendRequest (req.Stream); }
public static string [] GetKeyrings () { RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.ListKeyrings); ResponseMessage resp = SendRequest (req.Stream); return resp.GetStringList (); }
public static string GetDefaultKeyring () { RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.GetDefaultKeyring); ResponseMessage resp = SendRequest (req.Stream); return resp.GetString (); }
public static void SetDefaultKeyring (string newKeyring) { if (newKeyring == null) throw new ArgumentNullException ("newKeyring"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.SetDefaultKeyring, newKeyring); SendRequest (req.Stream); }
public static KeyringInfo GetKeyringInfo (string keyring) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.GetKeyringInfo, keyring); ResponseMessage resp = SendRequest (req.Stream); return new KeyringInfo (keyring, (resp.GetInt32 () != 0), resp.GetInt32 (), resp.GetDateTime (), resp.GetDateTime (), (resp.GetInt32 () != 0)); }
public static ArrayList GetItemACL (string keyring, int id) { if (keyring == null) throw new ArgumentNullException ("keyring"); RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.GetItemACL, keyring, id); ResponseMessage resp = SendRequest (req.Stream); int count = resp.GetInt32 (); ArrayList list = new ArrayList (count); for (int i = 0; i < count; i++) { list.Add (new ItemACL (resp.GetString (), resp.GetString (), (AccessRights) resp.GetInt32 ())); } return list; }
public static void LockAll () { RequestMessage req = new RequestMessage (); req.CreateSimpleOperation (Operation.LockAll); SendRequest (req.Stream); }