[INACTIVE] TLS 1.2 implementation in Rust
Rust
Switch branches/tags
Nothing to show
Latest commit 01e958b Jan 19, 2016 @klutzy Merge pull request #16 from rilut/use-sized-trait
Use Sized trait for Self
Permalink
Failed to load latest commit information.
examples Upgrade to rustc 1.1.0-dev (435622028 2015-05-04) (built 2015-05-05) May 13, 2015
src
Cargo.toml Upgrade to rustc 1.1.0-dev (435622028 2015-05-04) (built 2015-05-05) May 13, 2015
LICENSE Implement basic TLS 1.2 handshake Aug 4, 2014
README.md Update example Mar 18, 2015

README.md

suruga is Rust implementation of TLS 1.2.

It currently implements some core parts of TLS 1.2, NIST P-256 ECDHE and chacha20-poly1305.

Usage

extern crate suruga;

use std::io::prelude::*;
use std::net::TcpStream;

fn main() {
    test().unwrap();
}

fn test() -> suruga::tls_result::TlsResult<()> {
    let stream = try!(TcpStream::connect("www.google.com:443"));
    let mut client = try!(suruga::TlsClient::from_tcp(stream));
    let _len = try!(client.write(b"GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n"));

    let mut msg = vec![0u8; 100];
    try!(client.read(&mut msg));
    let msg = String::from_utf8_lossy(&msg);
    println!("msg: {}", msg);

    try!(client.close());

    Ok(())
}