Platforms to show: All Mac Windows Linux Cross-Platform

/Encryption/ECKey/ECKey Test


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/ECKey/ECKey Test

This example is the version from Mon, 22th Nov 2015.

Project "ECKey Test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() const NID_secp192k1 = 711 key = ECKeyMBS.KeyByCurveName(NID_secp192k1) Output.text = key.Description PublicKey = key.PublicKey PrivateKey = key.PrivateKey End EventHandler
End Control
Control Output Inherits TextArea
ControlInstance Output Inherits TextArea
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() if key <> nil then dim k as string = key.PrivateKey output.Text = EncodeHex(k) else output.Text = "" end if End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() if key <> nil then dim k as string = key.PublicKey output.Text = EncodeHex(k) else output.Text = "" end if End EventHandler
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action() dim dataToSign as string = "Hello World, this is just test data." if key = nil then MsgBox "no key?" Return end if dim DataHash as string = SHA512MBS.Hash(dataToSign) key = ECKeyMBS.OpenPrivateKey(PrivateKey) Signature = key.Sign(DataHash) output.Text = EncodeHex(Signature) End EventHandler
End Control
Control PushButton5 Inherits PushButton
ControlInstance PushButton5 Inherits PushButton
EventHandler Sub Action() dim dataToSign as string = "Hello World, this is just test data." if key = nil then MsgBox "no key?" Return end if dim DataHash as string = SHA512MBS.Hash(dataToSign) const NID_secp192k1 = 711 key = ECKeyMBS.OpenPublicKey(PublicKey, NID_secp192k1) if key.Verify(Signature, DataHash) then MsgBox "OK" else MsgBox "Failed" end if End EventHandler
End Control
Control PushButton6 Inherits PushButton
ControlInstance PushButton6 Inherits PushButton
EventHandler Sub Action() dim dataToSign as string = "Some other data" if key = nil then MsgBox "no key?" Return end if dim DataHash as string = SHA512MBS.Hash(dataToSign) const NID_secp192k1 = 711 key = ECKeyMBS.OpenPublicKey(PublicKey, NID_secp192k1) if key.Verify(Signature, DataHash) then MsgBox "OK" else MsgBox "Failed" end if End EventHandler
End Control
Property PrivateKey As string
Property PublicKey As String
Property Signature As string
Property key As ECKeyMBS
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

See also:

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


The biggest plugin in space...