[−][src]Crate psk_client
This is a simple wrapper around the PSK functionality exposed by the openssl crate. PR's to make this more generic, useable and informative (in terms of errors) are more than welcome.
Features
PSK Client has one feature which is openssl-vendored
which simply enables the vendored feature on the openssl crate, for further information, see the openssl-rs docs.
Usage
use psk_client::{PskClient, error::PskClientError}; use std::io::Write; fn main() -> Result<(), PskClientError> { let client = PskClient::builder("127.0.0.1:4433") .reset_ciphers() .cipher("PSK-AES128-CBC-SHA") .cipher("PSK-AES256-CBC-SHA") .identity("Client_identity") .key("4836525835726d466c743469426c55356e377375436254566d51476937724932") .build()?; match client.connect() { Ok(mut connection) => { if let Err(msg) = connection.write_all(b"Hello, World!") { eprintln!("Error writing to client: {}", msg); } } Err(e) => eprintln!("{}", e) } Ok(()) }
//! ## Default Ciphers
By default the client will use the following cipher string, this can be cleared by calling reset_ciphers()
on a PskClientBuilder
. You can supply your own ciphers, either after clearing the pre-defined cipers, or in addition to
them by calling cipher("<cipher>")
on a PskClientBuilder
+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL
Modules
builder | module for client builder. |
error | module for error handling. |
Structs
PskClient | The PSK client, this contains all the required information to generate and return a connection to a TCP socket over SSL where PSK negotiation has taken place. |