public interface ISecurityLibrary
extends com.sun.jna.Library
| Modifier and Type | Field and Description |
|---|---|
static int |
ERR_SEC_ITEM_NOT_FOUND |
static int |
ERR_SEC_SUCCESS |
static ISecurityLibrary |
library |
| Modifier and Type | Method and Description |
|---|---|
void |
CFRelease(com.sun.jna.Pointer cf)
Releases a Core Foundation object.
|
char |
CFStringGetCharacterAtIndex(com.sun.jna.Pointer theString,
long idx)
Returns the Unicode character at a specified location in a string.
|
int |
CFStringGetLength(com.sun.jna.Pointer theString)
Returns the number (in terms of UTF-16 code pairs) of Unicode characters in a string.
|
com.sun.jna.Pointer |
SecCopyErrorMessageString(int status,
com.sun.jna.Pointer reserved)
Returns a string explaining the meaning of a security result code.
|
int |
SecKeychainAddGenericPassword(com.sun.jna.Pointer keychain,
int serviceNameLength,
byte[] serviceName,
int accountNameLength,
byte[] accountName,
int passwordLength,
byte[] passwordData,
com.sun.jna.Pointer itemRef)
Adds a new generic password to a keychain.
|
int |
SecKeychainFindGenericPassword(com.sun.jna.Pointer keychainOrArray,
int serviceNameLength,
byte[] serviceName,
int accountNameLength,
byte[] accountName,
int[] passwordLength,
com.sun.jna.Pointer[] passwordData,
com.sun.jna.Pointer[] itemRef)
Finds the first generic 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.
|
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.
|
static final int ERR_SEC_SUCCESS
static final int ERR_SEC_ITEM_NOT_FOUND
static final ISecurityLibrary library
int SecKeychainAddGenericPassword(com.sun.jna.Pointer keychain,
int serviceNameLength,
byte[] serviceName,
int accountNameLength,
byte[] accountName,
int passwordLength,
byte[] passwordData,
com.sun.jna.Pointer 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 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 SecKeychainFindGenericPassword(com.sun.jna.Pointer keychainOrArray,
int serviceNameLength,
byte[] serviceName,
int accountNameLength,
byte[] accountName,
int[] passwordLength,
com.sun.jna.Pointer[] passwordData,
com.sun.jna.Pointer[] 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 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.com.sun.jna.Pointer SecCopyErrorMessageString(int status,
com.sun.jna.Pointer reserved)
status - A result code of type OSStatus returned by a security function.
https://developer.apple.com/documentation/security/1542001-security_framework_result_codesreserved - Reserved for future use. Pass NULL for this parameter.int CFStringGetLength(com.sun.jna.Pointer theString)
theString - The string to examine.char CFStringGetCharacterAtIndex(com.sun.jna.Pointer theString,
long idx)
theString - The string from which the Unicode character is obtained.idx - The position of the Unicode character in the CFString.void CFRelease(com.sun.jna.Pointer cf)
cf - CFType object to release. This value must not be NULL.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.Copyright © 2024. All rights reserved.