Platforms to show: All Mac Windows Linux Cross-Platform

Back to KeychainManagerMBS module.

Next items

KeychainManagerMBS.AddGenericPassword(keychain as KeychainMBS, serviceName as string, accountName as string, password as memoryblock) as KeychainItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Adds a new generic password to a keychain.
Example
// add password with password in MemoryBlock
dim Password as string = "mysecret"
dim PasswordData as MemoryBlock = ConvertEncoding(Password, encodings.UTF8)
dim ServiceName as string = "mytest"
dim Username as string = "myusername"
dim keychain as KeychainMBS = nil // use default

call KeychainManagerMBS.AddGenericPassword(keychain, ServiceName, Username, PasswordData)

dim e as Integer = KeychainManagerMBS.LastError
MsgBox str(e)+": "+KeychainManagerMBS.ErrorMessageString(e)

keychain: A reference to the keychain in which to store a generic password. Pass nil to specify the default keychain.
serviceName: The service name.
accountName: The account name.
password: A buffer containing the password data to be stored in the keychain.

Returns the new keychain item.
Lasterror is set.

The result code errSecNoDefaultKeychain indicates that no default keychain could be found. The result code errSecDuplicateItem indicates that you tried to add a password that already exists in the keychain. The result code errSecDataTooLarge indicates that you tried to add more data than is allowed for a structure of this type. Call ErrorMessageString function to get a human-readable string explaining the result.

This function adds a new generic password to the specified keychain. Required parameters to identify the password are serviceName and accountName, which are application-defined strings.

You can use this function to add passwords for accounts other than the Internet. For example, you might add AppleShare passwords, or passwords for your database or scheduling programs.

This function sets the initial access rights for the new keychain item so that the application creating the item is given trusted access.

This function automatically calls the function Unlock to display the Unlock Keychain dialog box if the keychain is currently locked.
Available in OS X v10.2 and later.

See also:

KeychainManagerMBS.AddGenericPassword(keychain as KeychainMBS, serviceName as string, accountName as string, password as string) as KeychainItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Adds a new generic password to a keychain.
Example
// add password with password in string
dim ServiceName as string = "mytest"
dim Username as string = "myusername"
dim Password as string = "mysecret"
dim keychain as KeychainMBS = nil // use default

call KeychainManagerMBS.AddGenericPassword(keychain, ServiceName, Username, Password)

dim e as Integer = KeychainManagerMBS.LastError
MsgBox str(e)+": "+KeychainManagerMBS.ErrorMessageString(e)

Takes UTF-8 text from password string for the password. Else the same as AddGenericPassword with memoryblock.

See also:

KeychainManagerMBS.AddInternetPassword(keychain as KeychainMBS, serverName as string, securityDomain as string, accountName as string, path as string, port as Integer, protocol as string, authenticationType as string, password as memoryblock) as KeychainItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Adds a new Internet password to a keychain.

keychain: A reference to the keychain in which to store an Internet password. Pass nil to specify the user's default keychain.
serverName: The server name.
securityDomain: The security domain. This parameter is optional. Pass "" if the protocol does not require it.
accountName: The account name.
path: The 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 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.
password: A buffer containing the password data to be stored in the keychain.

Returns the new keychain item.
Lasterror is set.

This function adds a new Internet server password to the specified keychain. Required parameters to identify the password are serverName and accountName (you cannot pass "" for both parameters). In addition, some protocols may require an optional securityDomain when authentication is requested. This function optionally returns a reference to the newly added item.

This function sets the initial access rights for the new keychain item so that the application creating the item is given trusted access.

This function automatically calls the function Unlock to display the Unlock Keychain dialog box if the keychain is currently locked.
Available in OS X v10.2 and later.

See also:

KeychainManagerMBS.AddInternetPassword(keychain as KeychainMBS, serverName as string, securityDomain as string, accountName as string, path as string, port as Integer, protocol as string, authenticationType as string, password as string) as KeychainItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Adds a new Internet password to a keychain.
Example
// add password with password in string
dim serverName as string = "mytest.com"
dim Password as string = "mysecret"
dim PasswordData as MemoryBlock = ConvertEncoding(Password, encodings.UTF8)
dim keychain as KeychainMBS = nil // use default
dim securityDomain as string = "ftp://mytest.com"
dim accountName as string = "myusername"
dim path as string = "/test"
dim port as Integer = 22
dim protocol as string = KeychainManagerMBS.kSecAttrProtocolFTP
dim authenticationType as string = KeychainManagerMBS.kSecAttrAuthenticationTypeDefault

call KeychainManagerMBS.AddInternetPassword(keychain, serverName, securityDomain, accountName, path, port, protocol, authenticationType, PasswordData)

dim e as Integer = KeychainManagerMBS.LastError
MsgBox str(e)+": "+KeychainManagerMBS.ErrorMessageString(e)

See KeychainManagerMBS.AddInternetPassword for details.
The password is stored as data with UTF-8 encoding.

See also:

KeychainManagerMBS.AddItem(Keychain as KeychainMBS, attributesDictionary as dictionary) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Adds one or more items to a keychain.
Example
dim a as new Dictionary

dim ServiceName as string = "mytest"
dim Username as string = "myusername"
dim Password as string = "mysecret"
dim PasswordData as MemoryBlock = ConvertEncoding(Password, encodings.UTF8)

a.value( KeychainManagerMBS.kSecAttrAccount ) = Username
a.value( KeychainManagerMBS.kSecAttrService ) = ServiceName
a.value( KeychainManagerMBS.kSecValueData ) = PasswordData
a.value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassGenericPassword

if KeychainManagerMBS.AddItem(nil, a) then
MsgBox "OK"
else
MsgBox "Failed."
end if

See other method variant for details.

See also:

KeychainManagerMBS.AddItem(Keychain as KeychainMBS, attributesDictionary as dictionary, byref result as Variant) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Adds one or more items to a keychain.
Example
dim a as new Dictionary

dim ServiceName as string = "mytest"
dim Username as string = "myusername"
dim Password as string = "mysecret"
dim PasswordData as MemoryBlock = ConvertEncoding(Password, encodings.UTF8)

a.value( KeychainManagerMBS.kSecAttrAccount ) = Username
a.value( KeychainManagerMBS.kSecAttrService ) = ServiceName
a.value( KeychainManagerMBS.kSecValueData ) = PasswordData
a.value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassGenericPassword

dim r as Variant
if KeychainManagerMBS.AddItem(nil, a, r) then
dim item as KeychainItemMBS = r
MsgBox "OK"
else
MsgBox "Failed."
end if

attributesDictionary: 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: Optional. 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.

Lasterror is set.

You specify attributes defining an item by adding key-value pairs to the attributes dictionary. To add multiple items to a keychain at once use the kSecUseItemList key (see section "Item List Key") with an array of items as its value. This is currently only supported for non-password items.

If you want the new keychain item to be shared among multiple applications, include the kSecAttrAccessGroup key in the attributes dictionary. The value of this key must be the name of a keychain access group to which all of the programs that will share this item belong.

When you use Xcode to create an application, Xcode adds an application-identifier entitlement to the application bundle. Keychain Services uses this entitlement to grant the application access to its own keychain items. You can also add a keychain-access-groups entitlement to the application and, in the entitlement property list file, specify an array of keychain access groups to which the application belongs. The property list file can have any name you like (for example, keychain-access-groups.plist). The Xcode build variable CODE_SIGN_ENTITLEMENTS should contain the SRCROOT relative path to the entitlement property list file. The property list file itself should be a dictionary with a top-level key called keychain-access-groups whose value is an array of strings. If you add such a property-list file to the application bundle, then the access group corresponding to the application-identifier entitlement is treated as the last element in the access groups array. If you do not include the kSecAttrAccessGroup key in the attributes dictionary when you call the AddItem function to add an item to the keychain, the function uses the first access group in the array by default. If there is no kSecAttrAccessGroup key in the attributes dictionary and there is no keychain-access-groups entitlement in the application bundle, then the access group of a newly created item is the value of the application-identifier entitlement.

For example, a development group in Apple might have the ID:

659823F3DC53.com.apple

and the application identifiers of their two applications might be:

659823F3DC53.com.apple.oneappleapp and

659823F3DC53.com.apple.twoappleapp

If both applications add a keychain-access-groups entitlement with one value in the array of access groups:

659823F3DC53.com.apple.netaccount

then both applications would add new keychain items to the 659823F3DC53.com.apple.netaccount access group by default and both applications would have access to keychain items in that group. In addition, each application would still have access to its own private keychain items: OneAppleApp would have access to items in keychain access group 659823F3DC53.com.apple.oneappleapp and TwoAppleApp would have access to items in 659823F3DC53.com.apple.twoappleapp.

Return types ("Search Results Constants") are specified as follows:

To obtain the data of the added item as an object of type Memoryblock, specify the return type key kSecReturnData with a value of true.
To obtain all the attributes of the added item as objects of type Dictionary, specify kSecReturnAttributes with a value of true.
To obtain a reference to the added item of type KeychainItemMBS, SecKeyRef, SecCertificateRef, or SecIdentityRef), specify kSecReturnRef with a value of True. This is the default behavior if a return type is not explicitly specified.
To obtain a persistent reference to the added item (an object of type Memoryblock), specify kSecReturnPersistentRef with a value of True. Note that unlike normal references, a persistent reference may be stored on disk or passed between processes.
If more than one of these return types is specified, the result is returned as an object of type Dictionary containing all the requested data.

Available in OS X v10.6 and later.

See also:

KeychainManagerMBS.AddItemAsync(attributesDictionary as dictionary, handler as AddItemAsyncCompletedMBS, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 21.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Asynchronous version of AddItem.

Work performs on a thread and the given delegate handler is called with result.

See also:

KeychainManagerMBS.AddItemAsync(Keychain as KeychainMBS, attributesDictionary as dictionary, handler as AddItemAsyncCompletedMBS, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 18.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Asynchronous version of AddItem.

Work performs on a thread and the given delegate handler is called with result.

See also:

KeychainManagerMBS.AllItems(keychain as KeychainMBS, itemClass as string) as KeychainItemMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Queries all items.

Keychain: If not nil, searches only this keychain.
ItemClass: The item class to find. For example kSecGenericPasswordItemClass.
Lasterror is set.
Returns array of keychain items.

KeychainManagerMBS.CopyMatching(Query as dictionary, byref result as Variant) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns one or more keychain items that match a search query, or copies attributes of specific keychain items.
Example
dim ServiceName as string = "mytest"
dim Username as string = "myusername"

// Build query
dim query as new Dictionary

query.value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassGenericPassword
query.Value( KeychainManagerMBS.kSecReturnAttributes ) = true
query.Value( KeychainManagerMBS.kSecMatchLimit ) = KeychainManagerMBS.kSecMatchLimitOne
query.value( KeychainManagerMBS.kSecAttrAccount ) = Username
query.value( KeychainManagerMBS.kSecAttrService ) = ServiceName

// search the item and show values from attribute dictionary
dim r as Variant
if KeychainManagerMBS.CopyMatching(query, r) then
if r isa Dictionary then
dim d as Dictionary = r

// show values
MsgBox "Creation Date: "+d.value(KeychainManagerMBS.kSecAttrCreationDate).dateValue.shortdate
MsgBox "Modification Date: "+d.value(KeychainManagerMBS.kSecAttrModificationDate).dateValue.shortdate
end if
end if

query: A dictionary containing an item class specification and optional attributes for controlling the search. See
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.

Lasterror is set.

You specify attributes defining a search by adding key-value pairs to the query dictionary.

A typical query consists of:

  • The class key ("Item Class Key Constant") and a class value constant ("Item Class Value Constants"), which specifies the class of items for which to search.
  • One or more attribute key-value pairs ("Attribute Item Keys and Values"), which specify the attribute data to be matched.
  • One or more search key-value pairs ("Search Keys"), which specify values that further refine the search.
  • A return-type key-value pair ("Search Results Constants"), specifying the type of results you desire.

Return types ("Search Results Constants") are specified as follows:

  • To obtain a reference (of type Memoryblock) to the data of a matching item, specify kSecReturnData with a value of true.
  • To obtain a dictionary (of type Dictionary) containing the attributes of a matching item, specify kSecReturnAttributes with a value of true.
  • To obtain a reference (of type KeychainItemMBS, SecKeyRef, SecCertificateRef, or SecIdentityRef) to a matching item, specify kSecReturnRef with a value of true.
  • To obtain a persistent reference (of type Memoryblock) to a matching item, specify kSecReturnPersistentRef with a value of true. Note that unlike normal references, a persistent reference may be stored on disk or passed between processes.
  • If more than one return type is specified (for example, kSecReturnRef and kSecReturnAttributes), the results are returned as a dictionary (that is, an object of type Dictionary) containing all the requested data.
By default, this function returns only the first match found. To obtain more than one matching item at a time, specify the search key kSecMatchLimit with a value greater than 1. The result will be an object of type Array containing up to that number of matching items.

Note: You cannot combine the kSecReturnData and kSecMatchLimitAll options when copying password items (items of class kSecInternetPasswordItemClass or kSecGenericPasswordItemClass), because copying each password item could require additional authentication. Instead, request a reference or persistent reference to the items, then request the data for only the specific passwords that you actually require.
By default, this function searches for items in the keychain. To instead provide your own set of items to be filtered by this search query, specify the search key kSecMatchItemList and provide as its value a Array containing items of type SecKeychainItemRef, SecKeyRef, SecCertificateRef, or SecIdentityRef. The objects in the provided array must all be of the same type.

To convert from persistent item references to normal item references, specify the search key kSecMatchItemList with a value that consists of an object of type array referencing an array containing one or more elements of type Memoryblock (the persistent references), and a return-type key of kSecReturnRef whose value is true. The objects in the provided array must all be of the same type.

When you use Xcode to create an application, Xcode adds an application-identifier entitlement to the application bundle. Keychain Services uses this entitlement to grant the application access to its own keychain items. You can also add a keychain-access-groups entitlement to the application and, in the entitlement property list file, specify an array of keychain access groups to which the application belongs. The property list file can have any name you like (for example, keychain-access-groups.plist). The Xcode build variable CODE_SIGN_ENTITLEMENTS should contain the SRCROOT relative path to the entitlement property list file. The property list file itself should be a dictionary with a top-level key called keychain-access-groups whose value is an array of strings. When you call the SecItemAdd function to add an item to the keychain, you can specify the access group to which that item should belong. By default, the SecItemCopyMatching function searches all the access groups to which the application belongs. However, you can add the kSecAttrAccessGroup key to the search dictionary to specify which access group to search for keychain items.

Availability
Available in OS X v10.6 and later.

KeychainManagerMBS.CopyMatchingAsync(Query as dictionary, handler as CopyMatchingAsyncCompletedMBS, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 18.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Asynchronous version of CopyMatching.

Work performs on a thread and the given delegate handler is called with result.

KeychainManagerMBS.CopyMatchingDictionaries(Query as dictionary) as Dictionary()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns one or more keychain items that match a search query, or copies attributes of specific keychain items.
Example
// Build query
dim query as new Dictionary

query.value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassGenericPassword
query.Value( KeychainManagerMBS.kSecReturnAttributes ) = true
query.Value( KeychainManagerMBS.kSecMatchLimit ) = KeychainManagerMBS.kSecMatchLimitAll

// search all items
dim dics() as Dictionary = KeychainManagerMBS.CopyMatchingDictionaries(query)

// pick first
dim dic as Dictionary = dics(0)

// and display
MsgBox "Service: "+dic.Value(KeychainManagerMBS.kSecAttrService)+EndOfLine+_
"Account: "+dic.Value(KeychainManagerMBS.kSecAttrAccount)

This is a variant of CopyMatching which uses kSecReturnAttributes to query array of dictionaries.

Some examples using this method:

KeychainManagerMBS.CopyMatchingItems(Query as dictionary) as KeychainItemMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns one or more keychain items that match a search query, or copies attributes of specific keychain items.
Example
// Build query
dim query as new Dictionary

query.value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassGenericPassword
query.Value( KeychainManagerMBS.kSecMatchLimit ) = KeychainManagerMBS.kSecMatchLimitAll
query.Value( KeychainManagerMBS.kSecAttrAccount ) = "myusername"

// search all items
dim items() as KeychainItemMBS = KeychainManagerMBS.CopyMatchingItems(query)

if UBound(items) = -1 then
MsgBox "nothing found."
else

// pick first
dim item as KeychainItemMBS = items(0)

// and display
MsgBox "Service: "+item.Service+EndOfLine+"Account: "+item.Account
end if

This is a variant of CopyMatching which uses kSecReturnRef to query array of KeychainItemMBS.

KeychainManagerMBS.Default as KeychainMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Retrieves the default keychain.
Example
MsgBox KeychainManagerMBS.Default.Path

Lasterror is set.

KeychainManagerMBS.DeleteItem(Query as Dictionary) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Deletes items that match a search query.
Example
dim ServiceName as string = "mytest"
dim Username as string = "myusername"

// Build query
dim query as new Dictionary

query.value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassGenericPassword
query.value( KeychainManagerMBS.kSecAttrAccount ) = Username
query.value( KeychainManagerMBS.kSecAttrService ) = ServiceName

// search the item and delete it

if KeychainManagerMBS.DeleteItem(query) then
MsgBox "Deleted"
else
MsgBox "Failed."
end if

query: A dictionary containing an item class specification and optional attributes for controlling the search.
Lasterror is set.

See the discussion section of the CopyMatching function for information about how to construct a search dictionary.

By default, this function deletes all items matching the specified query. You can change this behavior by specifying a key, as follows:

  • To delete an item identified by a transient reference, specify the kSecMatchItemList search key with a reference returned by using the kSecReturnRef return type key in a previous call to the SecItemCopyMatching or SecItemAdd functions.
  • To delete an item identified by a persistent reference, specify the kSecMatchItemList search key with a persistent reference returned by using the kSecReturnPersistentRef return type key to the SecItemCopyMatching or SecItemAdd functions.
  • If more than one of these return keys is specified, the behavior is undefined.

Available in OS X v10.6 and later.

KeychainManagerMBS.DomainDefault(domain as Integer) as KeychainMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Retrieves the default keychain from a specified preference domain.
Example
dim SystemKeychain as KeychainMBS = KeychainManagerMBS.DomainDefault(KeychainManagerMBS.kSecPreferencesDomainSystem)
msgbox SystemKeychain.name

domain: The preference domain from which you wish to retrieve the default keychain. See Preference Domain Constants for possible domain values.

Returns the keychain object of the default keychain in the specified preference domain.
Lasterror is set.

A preference domain is a set of security-related preferences, such as the default keychain and the current keychain search list. Use this function if you want to retrieve the default keychain for a specific preference domain. Use the KeychainManagerMBS.Default function if you want the default keychain for the current preference domain. See the PreferenceDomain function for a discussion of current and default preference domains.
Available in OS X v10.3 and later.

KeychainManagerMBS.DomainSearchList(domain as Integer) as KeychainMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Retrieves the keychain search list for a specified preference domain.
Example
dim SearchList() as KeychainMBS = KeychainManagerMBS.DomainSearchList(KeychainManagerMBS.kSecPreferencesDomainUser)
dim names() as String

for each k as KeychainMBS in SearchList
names.Append k.Name
next

MsgBox Join(names, EndOfLine)

domain: The preference domain from which you wish to retrieve the keychain search list. See Preference Domain Constants for possible domain values.

Returns the keychain search list of the specified preference domain.
Lasterror is set.

A preference domain is a set of security-related preferences, such as the default keychain and the current keychain search list. Use this function if you want to retrieve the keychain search list for a specific preference domain. Use the SearchList function if you want the keychain search list for the current preference domain. See the PreferenceDomain function for a discussion of current and default preference domains.
Available in OS X v10.3 and later.

KeychainManagerMBS.ErrorMessageString(error as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a string explaining the meaning of a security result code.

status: A result code of type OSStatus or CSSM_RETURN, returned by a security or CSSM function.

Returns a human-readable string describing the result, or empty string if no string is available for the specified result code.
Available in OS X v10.5 and later.

Some examples using this method:

KeychainManagerMBS.FindGenericItem(keychain as KeychainMBS, serviceName as string, accountName as string) as KeychainItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Finds the first generic keychain item based on the attributes passed.
Example
dim ServiceName as string = "mytest"
dim Username as string = "myusername"
dim keychain as KeychainMBS = nil // use default

dim item as KeychainItemMBS = KeychainManagerMBS.FindGenericItem(keychain, ServiceName, Username)

MsgBox "Label: "+item.label+EndOfLine+_
"Comment: "+item.comment+EndOfLine+_
"Account: "+item.Account

Same as KeychainManagerMBS.FindGenericPassword, but returns item instead of password.

KeychainManagerMBS.FindGenericPassword(keychain as KeychainMBS, serviceName as string, accountName as string, byref password as memoryblock) as KeychainItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Finds the first generic password based on the attributes passed.

keychain: A reference to a single keychain, or nil to search the user's default keychain search list.
serviceName: The service name.
accountName: The account name.
password: A memoryblock that holds the password data.

Returns the item object of the generic password.
Lasterror is set.

This function finds the first generic password item that matches the attributes you provide. Most attributes are optional; you should pass only as many as you need to narrow the search sufficiently for your application's intended use. This function optionally returns a reference to the found item.

This function decrypts the password before returning it to you. If the calling application is not in the list of trusted applications, the user is prompted before access is allowed. If the access controls for this item do not allow decryption, the function returns the errSecAuthFailed result code.

This function automatically calls the function Unlock to display the Unlock Keychain dialog box if the keychain is currently locked.

KeychainManagerMBS.FindInternetItem(keychain as KeychainMBS, serverName as string, securityDomain as string, accountName as string, path as string, port as Integer, protocol as string, authenticationType as string) as KeychainItemMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Keychain MBS MacClassic Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Finds the first Internet password item based on the attributes passed.

See KeychainManagerMBS.FindInternetPassword for details.

Next items

The items on this page are in the following plugins: MBS MacClassic Plugin.


The biggest plugin in space...