Platforms to show: All Mac Windows Linux Cross-Platform

/MacClassic/Keychain/Keychain Content


You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacClassic/Keychain/Keychain Content

This example is the version from Tue, 4th Dec 2023.

Project "Keychain Content.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open() Dim keychain As KeychainMBS = Nil // default KeychainManagerMBS.UserInteractionAllowed = false // find passwords Dim query As New Dictionary query.Value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassGenericPassword query.Value( KeychainManagerMBS.kSecReturnAttributes ) = True query.Value( KeychainManagerMBS.kSecMatchLimit ) = KeychainManagerMBS.kSecMatchLimitAll Dim dics() As Dictionary = KeychainManagerMBS.CopyMatchingDictionaries(Query) For Each value As Dictionary In dics Dim Label As String = value.Lookup(KeychainManagerMBS.kSecAttrLabel, "?") Dim Account As String = value.Lookup(KeychainManagerMBS.kSecAttrAccount, "") Dim Service As String = value.Lookup(KeychainManagerMBS.kSecAttrService, "?") Dim Klasse As String = value.Lookup("class", "?") Dim Password As String Dim passwordMem As MemoryBlock Dim item As KeychainItemMBS = KeychainManagerMBS.FindGenericPassword(keychain, Service, account, passwordMem) If passwordMem <> Nil Then Password = passwordMem Else Password = "n/a" // would need user to allow end if List.AddRow Klasse, Service, Account, label, Password Next // and internet passwords query.Value( KeychainManagerMBS.kSecClass ) = KeychainManagerMBS.kSecClassInternetPassword query.Value( KeychainManagerMBS.kSecReturnAttributes ) = True query.Value( KeychainManagerMBS.kSecMatchLimit ) = KeychainManagerMBS.kSecMatchLimitAll dics = KeychainManagerMBS.CopyMatchingDictionaries(Query) For Each value As Dictionary In dics Dim Label As String = value.Lookup(KeychainManagerMBS.kSecAttrLabel, "?") Dim Account As String = value.Lookup(KeychainManagerMBS.kSecAttrAccount, "?") Dim Server As String = value.Lookup(KeychainManagerMBS.kSecAttrServer, "?") Dim port As Integer = value.Lookup(KeychainManagerMBS.kSecAttrPort, 0) Dim protocol As String = value.Lookup(KeychainManagerMBS.kSecAttrProtocol, 0) Dim authType As String = value.Lookup(KeychainManagerMBS.kSecAttrAuthenticationType, 0) Dim path As String = value.Lookup(KeychainManagerMBS.kSecAttrPath, "") Dim securityDomain As String = value.Lookup(KeychainManagerMBS.kSecAttrSecurityDomain, "") Dim Klasse As String = value.Lookup("class", "?") Dim Password As String Dim passwordMem As MemoryBlock Dim item As KeychainItemMBS = KeychainManagerMBS.FindInternetPassword(keychain, Server, securityDomain, account, path, port, protocol, authType, passwordMem) If passwordMem <> Nil Then Password = passwordMem Else Password = "n/a" // would need user to allow End If List.AddRow Klasse, Server, Account, label, Password Next End EventHandler
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
MenuItem HelpMenu = "&Help"
End MenuBar
Sign
End Sign
End Project

See also:

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


The biggest plugin in space...