Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a interface to support diffie-hellman algorithm? #121

Closed
dllhlx opened this issue Nov 29, 2017 · 7 comments
Closed

Is there a interface to support diffie-hellman algorithm? #121

dllhlx opened this issue Nov 29, 2017 · 7 comments

Comments

@dllhlx
Copy link

dllhlx commented Nov 29, 2017

As the stream is not safe in grpc insecure channel, is there a interface that I can use diffie-hellman algorithm in transfer progress?

@dllhlx dllhlx changed the title Is there a interface to support diffie-hellman algorithm Is there a interface to support diffie-hellman algorithm? Nov 29, 2017
@BusyJay
Copy link
Member

BusyJay commented Nov 29, 2017

Why not just use secure channel?

@dllhlx
Copy link
Author

dllhlx commented Nov 30, 2017

@BusyJay In my application model, I can't use the secure channel. I can only use insecure channel but the stream is not safe, so if not there is an interface to support diffie-hellman in grpc-rs I can use to encrypt the data.

@siddontang
Copy link
Contributor

@dllhlx, does core C gRPC support this? If yes, you can help us to add this feature.

@dllhlx
Copy link
Author

dllhlx commented Nov 30, 2017

@BusyJay @siddontang can I add DH algorithm in file src/codec.rs and the pb_codec section like

pub mod pb_codec {
    use protobuf::{self, Message, MessageStatic};

    use error::Result;

    #[inline]
    pub fn ser<T: Message>(t: &T, buf: &mut Vec<u8>) {
        //add DH logic here <-------------
        t.write_to_vec(buf).unwrap()
    }

    #[inline]
    pub fn de<T: MessageStatic>(buf: &[u8]) -> Result<T> {
        //add DH logic here <-------------
        protobuf::parse_from_bytes(buf).map_err(From::from)
    }
}

@siddontang
Copy link
Contributor

We design to support different codec protocols, maybe it can work.

/cc @BusyJay

@dllhlx
Copy link
Author

dllhlx commented Dec 1, 2017

@siddontang I try this solution, ant it works!

@siddontang
Copy link
Contributor

Cool

@dllhlx dllhlx closed this as completed Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants