Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

The module KeychainManagerMBS

module KeychainManagerMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
module Keychain MBS MacClassic Plugin 13.1 Yes No No Yes, macOS only No
Function: The module for global keychain functions.
// build query
dim query as new Dictionary

dim domain as string = "test.test"
dim username as string = "testuser"

query.value( KeychainManagerMBS.kSecAttrServer ) = Domain
query.value( KeychainManagerMBS.kSecAttrAccount ) = Username
query.value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassInternetPassword
query.Value( KeychainManagerMBS.kSecMatchLimit ) = KeychainManagerMBS.kSecMatchLimitOne

// Build Dictionary with new values
dim newValues as new Dictionary
newValues.value( KeychainManagerMBS.kSecAttrComment ) = "Just a test"

// and update
if KeychainManagerMBS.UpdateItem(query, newValues) then
MsgBox "OK"
MsgBox "Failed."
end if

Feedback, Comments & Corrections

Error Codes

Constant Value Description
ErrorAuthorizationFailed -25293 The user name or passphrase you entered is not correct.
ErrorDuplicatedItem -25299 The specified item already exists in the keychain.
ErrorFailedToAllocated -108 Failed to allocate memory.
ErrorFailedToDecode -26275 Unable to decode the provided data.
ErrorInteractionNotAllowed -25308 User interaction is not allowed.
ErrorInvalidParameter -50 Invalid Parameters.
ErrorNone 0 No error.
ErrorNotAvailable -25291 No keychain is available. You may need to restart your computer.
ErrorNotFound -25300 The specified item could not be found in the keychain.

Keychain Preference Domain Constants

Constant Value Description
kSecPreferencesDomainCommon 2 Indicates the preferences are common to everyone.
Available in OS X v10.3 and later.
kSecPreferencesDomainDynamic 3 Indicates a dynamic search list (typically provided by removable keychains such as smart cards).
Available in OS X v10.4 and later.
kSecPreferencesDomainSystem 1 Indicates the system or daemon preference domain preferences.
Available in OS X v10.3 and later.
kSecPreferencesDomainUser 0 Indicates the user preference domain preferences.
Available in OS X v10.3 and later.

Some examples which use this module:

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

MBS Xojo Plugins