SodiumKeyExchange
struct SodiumKeyExchange
A wrapper for key exchange.
-
The initializer is disabled.
Declaration
Swift
fileprivate init() -
The size of the secret key in bytes.
Declaration
Swift
let secretKeySizeInBytes: Int -
The size of the session key in bytes.
Declaration
Swift
let sessionKeySizeInBytes: Int -
The size of the public key in bytes.
Declaration
Swift
let publicKeySizeInBytes: Int -
Generate a keypair that can be used for exchanging keys.
Declaration
Swift
func keypair(publicKeyPtr: UnsafeMutablePointer<UInt8>, secretKeyPtr: UnsafeMutablePointer<UInt8>)Parameters
publicKeyPtrThe pointer to where the public key will be stored.
secretKeyPtrThe pointer to where the secret key will be stored.
-
Calculate session keys for the client side.
Declaration
Swift
func client_session_keys( rxPtr: UnsafeMutablePointer<UInt8>, txPtr: UnsafeMutablePointer<UInt8>, clientPk: UnsafePointer<UInt8>, clientSk: UnsafePointer<UInt8>, serverPk: UnsafePointer<UInt8> ) -> Int32Parameters
rxPtrA pointer to where the session key, that is used to receive data from the server, should be stored.
txPtrA pointer to where the session key, that is used to send data to the server, should be stored.
clientPkA pointer to the client’s public key.
clientSkA pointer to the client’s secret key.
serverPkA pointer to the server’s public key.
Return Value
0on success and-1ifserverPkis not acceptible. -
Calculate session keys for the server side.
Declaration
Swift
func server_session_keys( rxPtr: UnsafeMutablePointer<UInt8>, txPtr: UnsafeMutablePointer<UInt8>, serverPk: UnsafePointer<UInt8>, serverSk: UnsafePointer<UInt8>, clientPk: UnsafePointer<UInt8> ) -> Int32Parameters
rxPtrA pointer to where the session key, that is used to receive data from the client, should be stored.
txPtrA pointer to where the session key, that is used to sen data to the client, should be stored.
serverPkA pointer to the server’s public key.
serverSkA pointer to the server’s secret key.
clientPkA pointer to the client’s public key.
Return Value
0on success and-1ifclientPkis not acceptible.
View on GitHub
SodiumKeyExchange Structure Reference