node_pcap icon indicating copy to clipboard operation
node_pcap copied to clipboard

How to import RSA private key through pcap?

Open junhui opened this issue 9 years ago • 5 comments

i'm going to use node_pcap analysis http traffic which include https, i know something like wireshark have way to import the RSA key, is there any way i can use node_pcap+libpcap to do the samething?

junhui avatar Mar 06 '15 05:03 junhui

No, you are either going to have to do your own decryption. Or use a tool like ssldump to do the decryption first, though this will not result in a file usable by node_pcap.

jmaxxz avatar Mar 06 '15 13:03 jmaxxz

If you want to contribute an implementation of decryption, I think that'd be great. :)

mranney avatar Mar 06 '15 16:03 mranney

^this

jmaxxz avatar Mar 06 '15 17:03 jmaxxz

will try to see what i can do

junhui avatar Mar 09 '15 05:03 junhui

I have also looked into this, and unless there is someone who is already familiar with (or has a lot of time for learning) the basics of SSL, this is a rather daunting task.

For starters, Node's own ssl and tls modules both rely on openssl and these SecureContext native bindings.

SSL programming with openssl is explained here. On the client side, it boils down to a connection being managed by openssl itself (established through SSL_connect):

Call SSL_connect() (in the client) or SSL_accept() (in the server) to perform the SSL handshake. Certificate verification is performed during the handshake. SSL_get_verify_result() cannot obtain the result before the verification process.

Not sure, if one can easily detach the transport from the security layer. Maybe piping from pcap to openssl would make things easier. Also note that whatever the mechanism, decryption must be handled before filtering.

Domiii avatar May 15 '15 13:05 Domiii