Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacClassic/Keychain/Keychain Test
Function:
Required plugins for this example: MBS MacClassic Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacClassic/Keychain/Keychain Test
This example is the version from Mon, 7th Apr 2013.
Project "Keychain Test.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control GroupBox1 Inherits GroupBox
ControlInstance GroupBox1 Inherits GroupBox
End Control
Control EditField1 Inherits TextField
ControlInstance EditField1 Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control EditField2 Inherits TextField
ControlInstance EditField2 Inherits TextField
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim AccountName as string = EditField1.text dim ServiceName as string = "RBTest" dim Password as string = EditField2.text dim keychain as KeychainMBS = nil // default dim i as KeyChainItemMBS = KeyChainManagerMBS.addGenericPassword(keychain, ServiceName, AccountName, Password) if i<>nil then MsgBox "Password added to current keychain." else MsgBox "Could not add password to keychain. Maybe no Keychain software installed or not enough permissions to create an entry in the keychain (e.g. booted from CD)" end if End EventHandler
End Control
Control GroupBox2 Inherits GroupBox
ControlInstance GroupBox2 Inherits GroupBox
End Control
Control EditField3 Inherits TextField
ControlInstance EditField3 Inherits TextField
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() dim AccountName as string = EditField3.text dim ServiceName as string = "RBTest" dim keychain as KeychainMBS = nil // default dim password as MemoryBlock dim i as KeychainItemMBS = KeychainManagerMBS.FindGenericPassword(keychain, ServiceName, AccountName, password) if i<>nil then dim s as string = DefineEncoding(Password, encodings.UTF8) StaticText5.text = s else StaticText5.text="Password not found!" end if End EventHandler
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control GroupBox3 Inherits GroupBox
ControlInstance GroupBox3 Inherits GroupBox
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() dim items() as KeychainItemMBS = KeyChainManagerMBS.AllItems(nil, KeyChainManagerMBS.kSecGenericPasswordItemClass) for each item as KeychainItemMBS in items if item.Service = "RBTest" then listbox1.AddRow item.Account end if next End EventHandler
End Control
Control Listbox1 Inherits ListBox
ControlInstance Listbox1 Inherits ListBox
EventHandler Sub DoubleClick() dim AccountName as string = me.cell(me.listindex,0) dim ServiceName as string = "RBTest" dim keychain as KeychainMBS = nil // default dim password as MemoryBlock dim i as KeychainItemMBS = KeychainManagerMBS.FindGenericPassword(keychain, ServiceName, AccountName, password) if i<>nil then dim s as string = DefineEncoding(Password, encodings.UTF8) MsgBox s else MsgBox "Password not found!" end if End EventHandler
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS FileMaker tutorial videos