Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Encryption/Sign and Verify/SignTest
Required plugins for this example: MBS Encryption Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Encryption/Sign and Verify/SignTest
This example is the version from Thu, 6th Apr 2016.
Project "SignTest.rbp"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() const NID_sha1 = 64 dim test_pem as string = ReadFile("test.pem") dim test_pub as string = ReadFile("test.pub") dim data as string = ReadFile("Create Keys.rtf") // some data file dim signature as string // create signature Signature = OpenSSLMBS.SignData(data, test_pem) if Signature = "" then // failed break end if // verify with private key dim r1 as Boolean = OpenSSLMBS.VerifyData(data, signature, test_pem) // verify with public key dim r2 as Boolean = OpenSSLMBS.VerifyData(data, signature, test_pub) dim signatureFile as string = ReadFile("signature.sha1") // verify with private key dim r3 as Boolean = OpenSSLMBS.VerifyData(data, signatureFile, test_pem) // verify with public key dim r4 as Boolean = OpenSSLMBS.VerifyData(data, signatureFile, test_pub) if r1 and r2 and r3 and r4 then MsgBox "All OK" end if break End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
Private Function ReadFile(filename as string) As string dim f as FolderItem = FindFile(filename) dim b as BinaryStream = BinaryStream.Open(f) Return b.Read(B.Length) End Function
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

Feedback, Comments & Corrections

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

MBS Xojo Chart Plugins