Skip to content

Conversation

@ordinary-hacker
Copy link

Still just a draft, right now the code compiles and it already has some stuff tied up for it to support these two encryption methods. This draft PR is mostly to keep a little bit on progress and also if anyone has any suggestions and stuff like that.

I'll keep adding more commits to this as I test stuff, change stuff, and so on.

Fixes #59

@ordinary-hacker
Copy link
Author

Rn I mostly just need to actually test this and do some code refinements

@ordinary-hacker ordinary-hacker marked this pull request as ready for review August 14, 2025 16:13
@ordinary-hacker
Copy link
Author

Now this is ready to merge! In case needed for vetting here's a little guide to test:

first TLS works with DER format, meanwhile DTLS with PKCS#12 format, you can generate some quick test files with:

openssl genrsa -out server-key.pem 2048 && \
openssl req -new -x509 -key server-key.pem -out server-cert.pem -days 365 -subj "/CN=localhost" && \
openssl x509 -in server-cert.pem -outform DER -out server-cert-new.der && \
openssl rsa -in server-key.pem -outform DER -out server-key-new.der && \
openssl pkcs12 -export -in server-cert.pem -inkey server-key.pem -out server-new.p12 -name "rustcat-server" -passout pass:

then for example if using rcat listener and client for TLS

# Terminal 1 (TLS Listener)
./target/debug/rcat listen -i --protocol tls --cert server-cert-new.der --key server-key-new.der 8443

# Terminal 2 (rcat TLS Client)
./target/debug/rcat connect -s bash --protocol tls localhost 8443

rcat TLS listener but with openssl client

# Terminal 1 (TLS Listener)
./target/debug/rcat listen -i --protocol tls --cert server-cert-new.der --key server-key-new.der 8443

# Terminal 2 (OpenSSL Client)
openssl s_client -connect localhost:8443 -verify_return_error

rcat for DTLS listener and client

# Terminal 1 (DTLS Listener)
./target/debug/rcat listen -i --protocol dtls --cert server-new.p12 8444

# Terminal 2 (rcat DTLS Client)
./target/debug/rcat connect -s bash --protocol dtls --cert server-new.p12 localhost 8444

if just doing some echo tests for TLS:

# Terminal 1
./target/debug/rcat listen -i --protocol tls --cert server-cert-new.der --key server-key-new.der 8443

# Terminal 2
echo "Hello TLS" | openssl s_client -connect localhost:8443 -quiet

for dtls:

# Terminal 1
./target/debug/rcat listen -i --protocol dtls --cert server-new.p12 8444

# Terminal 2
./target/debug/rcat connect -s cat --protocol dtls --cert server-new.p12 localhost 8444

@robiot
Copy link
Owner

robiot commented Aug 14, 2025

looks cool

@ordinary-hacker
Copy link
Author

@robiot thanks :D

could you do the merge???

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

Successfully merging this pull request may close these issues.

Add crypto TCP/UDP data

2 participants