public interface Security
extends com.sun.jna.Library
| Modifier and Type | Field and Description |
|---|---|
static int |
errSecItemNotFound |
static int |
errSecSuccess |
| Modifier and Type | Method and Description |
|---|---|
com.sun.jna.Pointer |
SecCopyErrorMessageString(int status,
com.sun.jna.Pointer reserved)
Returns a string explaining the meaning of a security result code.
|
int |
SecItemAdd(com.sun.jna.Pointer attributes,
com.sun.jna.ptr.PointerByReference result)
Adds one or more items to a keychain.
|
int |
SecItemCopyMatching(com.sun.jna.Pointer query,
com.sun.jna.ptr.PointerByReference result)
Returns one or more keychain items that match a search query, or copies attributes of specific keychain items.
|
int |
SecItemDelete(com.sun.jna.Pointer query)
Deletes items that match a search query.
|
int |
SecItemUpdate(com.sun.jna.Pointer query,
com.sun.jna.Pointer attributesToUpdate)
Modifies items that match a search query.
|
int |
SecKeychainAddGenericPassword(com.sun.jna.Pointer keychain,
int serviceNameLength,
byte[] serviceName,
int accountNameLength,
byte[] accountName,
int passwordLength,
byte[] passwordData,
com.sun.jna.ptr.PointerByReference itemRef)
Adds a new generic password to a keychain.
|
int |
SecKeychainAddInternetPassword(com.sun.jna.Pointer keychain,
int serverNameLength,
byte[] serverName,
int securityDomainLength,
byte[] securityDomain,
int accountNameLength,
byte[] accountName,
int pathLength,
byte[] path,
int port,
int protocol,
int authenticationType,
int passwordLength,
byte[] passwordData,
com.sun.jna.ptr.PointerByReference itemRef)
Adds a new Internet password to a keychain.
|
int |
SecKeychainFindGenericPassword(com.sun.jna.Pointer keychainOrArray,
int serviceNameLength,
byte[] serviceName,
int accountNameLength,
byte[] accountName,
com.sun.jna.ptr.IntByReference passwordLength,
com.sun.jna.ptr.PointerByReference passwordData,
com.sun.jna.ptr.PointerByReference itemRef)
Finds the first generic password based on the attributes passed.
|
int |
SecKeychainFindInternetPassword(com.sun.jna.Pointer keychainOrArray,
int serverNameLength,
byte[] serverName,
int securityDomainLength,
byte[] securityDomain,
int accountNameLength,
byte[] accountName,
int pathLength,
byte[] path,
int port,
int protocol,
int authenticationType,
com.sun.jna.ptr.IntByReference passwordLength,
com.sun.jna.ptr.PointerByReference passwordData,
com.sun.jna.ptr.PointerByReference itemRef)
Finds the first Internet password based on the attributes passed.
|
int |
SecKeychainItemDelete(com.sun.jna.Pointer itemRef)
Deletes a keychain item from the default keychain’s permanent data store.
|
int |
SecKeychainItemFreeContent(com.sun.jna.Pointer attrList,
com.sun.jna.Pointer data)
Releases the memory used by the keychain attribute list and the keychain data retrieved in a call to the SecKeychainItemCopyContent function.
|
int |
SecKeychainItemModifyContent(com.sun.jna.Pointer itemRef,
com.sun.jna.Pointer attrList,
int length,
byte[] data)
Updates an existing keychain item after changing its attributes and/or data.
|
int |
SecKeychainOpen(java.lang.String pathName,
com.sun.jna.ptr.PointerByReference keychainRef)
Opens a keychain.
|
static final int errSecSuccess
static final int errSecItemNotFound
int SecItemCopyMatching(com.sun.jna.Pointer query,
com.sun.jna.ptr.PointerByReference result)
query - A dictionary containing an item class specification (Keychain Item Class Keys and Values) and optional attributes for controlling the search. See Keychain Services Constants for a description of currently defined search attributes.result - On return, a reference to the found items. The exact type of the result is based on the search attributes supplied in the query, as discussed below.int SecItemAdd(com.sun.jna.Pointer attributes,
com.sun.jna.ptr.PointerByReference result)
attributes - A dictionary containing an item class key-value pair (Keychain Item Class Keys and Values) and optional attribute key-value pairs (Attribute Item Keys and Values) specifying the item's attribute values.result - On return, a reference to the newly added items. The exact type of the result is based on the values supplied in attributes, as discussed below. Pass NULL if this result is not required.int SecItemUpdate(com.sun.jna.Pointer query,
com.sun.jna.Pointer attributesToUpdate)
query - A dictionary containing an item class specification and optional attributes for controlling the search. Specify the items whose values you wish to change. See Search Keys for a description of currently defined search attributes.attributesToUpdate - A dictionary containing the attributes whose values should be changed, along with the new values. Only real keychain attributes are permitted in this dictionary (no "meta" attributes are allowed.) See Attribute Item Keys and Values for a description of currently defined value attributes.int SecItemDelete(com.sun.jna.Pointer query)
query - A dictionary containing an item class specification and optional attributes for controlling the search. See Search Keys for a description of currently defined search attributes.com.sun.jna.Pointer SecCopyErrorMessageString(int status,
com.sun.jna.Pointer reserved)
status - A result code of type OSStatus or CSSM_RETURN, returned by a security or CSSM function.reserved - Reserved for future use. Pass NULL for this parameter.int SecKeychainOpen(java.lang.String pathName,
com.sun.jna.ptr.PointerByReference keychainRef)
pathName - A constant character string representing the POSIX path to the keychain to open.keychainRef - On return, a pointer to the keychain object. You must call the CFRelease function to release this object when you are finished using it.int SecKeychainAddGenericPassword(com.sun.jna.Pointer keychain,
int serviceNameLength,
byte[] serviceName,
int accountNameLength,
byte[] accountName,
int passwordLength,
byte[] passwordData,
com.sun.jna.ptr.PointerByReference itemRef)
keychain - A reference to the keychain in which to store a generic password. Pass NULL to specify the default keychain.serviceNameLength - The length of the serviceName character string.serviceName - A UTF-8 encoded character string representing the service name.accountNameLength - The length of the accountName character string.accountName - A UTF-8 encoded character string representing the account name.passwordLength - The length of the passwordData buffer.passwordData - A pointer to a buffer containing the password data to be stored in the keychain. Before calling this function, allocate enough memory for the buffer to hold the data you want to store.itemRef - On return, a pointer to a reference to the new keychain item. Pass NULL if you don’t want to obtain this object. You must allocate the memory for this pointer. You must call the CFRelease function to release this object when you are finished using it.int SecKeychainFindGenericPassword(com.sun.jna.Pointer keychainOrArray,
int serviceNameLength,
byte[] serviceName,
int accountNameLength,
byte[] accountName,
com.sun.jna.ptr.IntByReference passwordLength,
com.sun.jna.ptr.PointerByReference passwordData,
com.sun.jna.ptr.PointerByReference itemRef)
keychainOrArray - A reference to an array of keychains to search, a single keychain, or NULL to search the user’s default keychain search list.serviceNameLength - The length of the serviceName character string.serviceName - A UTF-8 encoded character string representing the service name.accountNameLength - The length of the accountName character string.accountName - A UTF-8 encoded character string representing the account name.passwordLength - On return, the length of the buffer pointed to by passwordData.passwordData - On return, a pointer to a buffer that holds the password data. Pass NULL if you want to obtain the item object but not the password data. In this case, you must also pass NULL in the passwordLength parameter. You should use the SecKeychainItemFreeContent function to free the memory pointed to by this parameter.itemRef - On return, a pointer to the item object of the generic password. You are responsible for releasing your reference to this object. Pass NULL if you don’t want to obtain this object.int SecKeychainAddInternetPassword(com.sun.jna.Pointer keychain,
int serverNameLength,
byte[] serverName,
int securityDomainLength,
byte[] securityDomain,
int accountNameLength,
byte[] accountName,
int pathLength,
byte[] path,
int port,
int protocol,
int authenticationType,
int passwordLength,
byte[] passwordData,
com.sun.jna.ptr.PointerByReference itemRef)
keychain - A reference to the keychain in which to store an Internet password. Pass NULL to specify the user’s default keychain.serverNameLength - The length of the serverName character string.serverName - A UTF-8 encoded character string representing the server name.securityDomainLength - The length of the securityDomain character string.securityDomain - A UTF-8 encoded character string representing the security domain. This parameter is optional. Pass NULL if the protocol does not require it.accountNameLength - The length of the accountName character string.accountName - A UTF-8 encoded character string representing the account name.pathLength - The length of the path character string.path - A UTF-8 encoded character string representing the path.port - The TCP/IP port number. If no specific port number is associated with this password, pass 0.protocol - The protocol associated with this password. See Keychain Protocol Type Constants for a description of possible values.authenticationType - The authentication scheme used. See Keychain Authentication Type Constants for a description of possible values. Pass the constant kSecAuthenticationTypeDefault, to specify the default authentication scheme.passwordLength - The length of the passwordData buffer.passwordData - A pointer to a buffer containing the password data to be stored in the keychain.itemRef - On return, a pointer to a reference to the new keychain item. Pass NULL if you don’t want to obtain this object. You must allocate the memory for this pointer. You must call the CFRelease function to release this object when you are finished using it.int SecKeychainFindInternetPassword(com.sun.jna.Pointer keychainOrArray,
int serverNameLength,
byte[] serverName,
int securityDomainLength,
byte[] securityDomain,
int accountNameLength,
byte[] accountName,
int pathLength,
byte[] path,
int port,
int protocol,
int authenticationType,
com.sun.jna.ptr.IntByReference passwordLength,
com.sun.jna.ptr.PointerByReference passwordData,
com.sun.jna.ptr.PointerByReference itemRef)
keychainOrArray - A reference to an array of keychains to search, a single keychain or NULL to search the user’s default keychain search list.serverNameLength - The length of the serverName character string.serverName - A UTF-8 encoded character string representing the server name.securityDomainLength - The length of the securityDomain character string.securityDomain - A UTF-8 encoded character string representing the security domain. This parameter is optional, as not all protocols require it. Pass NULL if it is not required.accountNameLength - The length of the accountName character string.accountName - A UTF-8 encoded character string representing the account name.pathLength - The length of the path character string.path - A UTF-8 encoded character string representing the path.port - The TCP/IP port number. Pass 0 to ignore the port number.protocol - The protocol associated with this password. See Keychain Protocol Type Constants for a description of possible values.authenticationType - The authentication scheme used. See Keychain Authentication Type Constants for a description of possible values. Pass the constant kSecAuthenticationTypeDefault, to specify the default authentication scheme.passwordLength - On return, the length of the buffer pointed to by passwordData.passwordData - On return, a pointer to a buffer containing the password data. Pass NULL if you want to obtain the item object but not the password data. In this case, you must also pass NULL in the passwordLength parameter. You should use the SecKeychainItemFreeContent function to free the memory pointed to by this parameter.itemRef - On return, a pointer to the item object of the Internet password. You are responsible for releasing your reference to this object. Pass NULL if you don’t want to obtain this object.int SecKeychainItemDelete(com.sun.jna.Pointer itemRef)
itemRef - A keychain item object of the item to delete. You must call the CFRelease function to release this object when you are finished using it.int SecKeychainItemModifyContent(com.sun.jna.Pointer itemRef,
com.sun.jna.Pointer attrList,
int length,
byte[] data)
itemRef - A reference to the keychain item to modify.attrList - A pointer to the list of attributes to set and their new values. Pass NULL if you have no need to modify attributes.length - The length of the buffer pointed to by the data parameter. Pass 0 if you pass NULL in the data parameter.data - A pointer to a buffer containing the data to store. Pass NULL if you do not need to modify the data.int SecKeychainItemFreeContent(com.sun.jna.Pointer attrList,
com.sun.jna.Pointer data)
attrList - A pointer to the attribute list to release. Pass NULL if there is no attribute list to release.data - A pointer to the data buffer to release. Pass NULL if there is no data to release.