Example: /Encryption/Diffie Hellman Key Generation

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/Encryption/Diffie Hellman Key Generation


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/Diffie Hellman Key Generation

This example is the version from Wed, 24th Oct 2017.

Project "Diffie Hellman Key Generation.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control list Inherits Listbox
ControlInstance list Inherits Listbox
EventHandler Sub DoubleClick() MsgBox me.Cell(me.ListIndex,1) End EventHandler
End Control
EventHandler Sub Open() // Our chosen curve must be used by both sides in the exchange dim EC_Curve_ID as integer = 415 // NID_X9_62_prime256v1 dim ec_dhe as new ECDHEMBS(EC_Curve_ID) dim publicKey as string = ec_dhe.PublicKey list.AddRow "My Public Key: ", publicKey // Normally here, we would send our public key and receive our peer's public key. // For example's sake, let's just generate a new key using the same curve dim ec_dhePeer as new ECDHEMBS(EC_Curve_ID) dim peerKey as string = ec_dhePeer.PublicKey list.AddRow "Peer Public Key: ", peerKey // Now that we have the peer's public key, let's derive the shared secret on the original side dim sharedSecret as string = ec_dhe.DeriveSecretKey(peerKey) list.AddRow "Shared Secret: ", EncodeHex(sharedSecret) // and do same on peer dim sharedSecretAtPeer as string = ec_dhePeer.DeriveSecretKey(publicKey) list.AddRow "Shared Secret on peer: ",EncodeHex(sharedSecretAtPeer) // WARNING!!! // peerKey, publicKey, and sharedSecret are no longer accessible once freed // If you would like to keep them, put them in a property of windows/class/module End EventHandler
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

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


💬 Ask a question or report a problem