Guest User

Untitled

a guest
Apr 17th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. /*Copyright (c) 2007 Extendmac, LLC. <support@extendmac.com>
  2.  
  3. Permission is hereby granted, free of charge, to any person
  4. obtaining a copy of this software and associated documentation
  5. files (the "Software"), to deal in the Software without
  6. restriction, including without limitation the rights to use,
  7. copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the
  9. Software is furnished to do so, subject to the following
  10. conditions:
  11.  
  12. The above copyright notice and this permission notice shall be
  13. included in all copies or substantial portions of the Software.
  14.  
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  17. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  19. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  20. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. OTHER DEALINGS IN THE SOFTWARE.
  23. */
  24.  
  25.  
  26. #import <Cocoa/Cocoa.h>
  27. #import <Security/Security.h>
  28.  
  29. @interface EMKeychainItem : NSObject {
  30. NSString *myPassword;
  31. NSString *myUsername;
  32. NSString *myLabel;
  33. SecKeychainItemRef coreKeychainItem;
  34. }
  35.  
  36. + (void)lockKeychain;
  37. + (void)unlockKeychain;
  38. + (void)setLogsErrors:(BOOL)flag;
  39.  
  40. - (NSString *)password;
  41. - (NSString *)username;
  42. - (NSString *)label;
  43. - (BOOL)setPassword:(NSString *)newPassword;
  44. - (BOOL)setUsername:(NSString *)newUsername;
  45. - (BOOL)setLabel:(NSString *)newLabel;
  46.  
  47. @end
  48.  
  49. @interface EMGenericKeychainItem : EMKeychainItem
  50. {
  51. NSString *myServiceName;
  52. }
  53.  
  54. + (EMGenericKeychainItem *)genericKeychainItemForService:(NSString *)serviceNameString withUsername:(NSString *)usernameString;
  55. + (EMGenericKeychainItem *)addGenericKeychainItemForService:(NSString *)serviceNameString withUsername:(NSString *)usernameString password:(NSString *)passwordString;
  56.  
  57. + (void) setKeychainPassword:(NSString*)password forUsername:(NSString*)username service:(NSString*)serviceName;
  58. + (NSString*) passwordForUsername:(NSString*)username service:(NSString*)serviceName;
  59.  
  60. + (id)genericKeychainItem:(SecKeychainItemRef)item forServiceName:(NSString *)serviceName username:(NSString *)username password:(NSString *)password;
  61. - (NSString *)serviceName;
  62. - (BOOL)setServiceName:(NSString *)newServiceName;
  63. @end
  64.  
  65. @interface EMInternetKeychainItem : EMKeychainItem
  66. {
  67. NSString *myServer;
  68. NSString *myPath;
  69. int myPort;
  70. SecProtocolType myProtocol;
  71. }
  72.  
  73. + (EMInternetKeychainItem *)internetKeychainItemForServer:(NSString *)serverString withUsername:(NSString *)usernameString path:(NSString *)pathString port:(int)port protocol:(SecProtocolType)protocol;
  74. + (EMInternetKeychainItem *)addInternetKeychainItemForServer:(NSString *)serverString withUsername:(NSString *)usernameString password:(NSString *)passwordString path:(NSString *)pathString port:(int)port protocol:(SecProtocolType)protocol;
  75.  
  76. + (id)internetKeychainItem:(SecKeychainItemRef)item forServer:(NSString *)server username:(NSString *)username password:(NSString *)password path:(NSString *)path port:(int)port protocol:(SecProtocolType)protocol;
  77. - (NSString *)server;
  78. - (NSString *)path;
  79. - (int)port;
  80. - (SecProtocolType)protocol;
  81. - (BOOL)setServer:(NSString *)newServer;
  82. - (BOOL)setPath:(NSString *)newPath;
  83. - (BOOL)setPort:(int)newPort;
  84. - (BOOL)setProtocol:(SecProtocolType)newProtocol;
  85. @end
Add Comment
Please, Sign In to add comment