blspeiser / webrtc-extension

C++ project that extends libwebrtc with additional code, specifically AES 256 encryption & decryption for WebRTC frame data.
https://medium.com/@sbaruch/compiling-google-webrtc-extensions-for-android-1669db71e0e6
0 stars 0 forks source link

Hello, sorry to bother you. I am using this encryption library on the Conversations app and it keeps crashing. I did not catch any exceptions. What should I do? #1

Closed Tunshutegong closed 1 month ago

blspeiser commented 1 month ago

Hello! It's not going to throw any exceptions because the encryption happens in the native side as part of the Google WebRTC implementation; the Java side is just a thin wrapper.

What is the error you are getting? Do you have any logs available? There isn't enough information here to understand what's going on. I assume you are using the frame encryptor?

If it's initializing correctly, then you should have a log that looks something like this:

io.cambium.webrtc.srtp               V  Key size: 32,  Initialization Vector size: 16
io.cambium.webrtc.srtp               V  Reading byte arrays from Java Aes256FrameEncryptor...
io.cambium.webrtc.srtp               V  Creative native Aes256FrameEncryptor...
io.cambium.webrtc.srtp               D  Created native Aes256FrameEncryptor successfully, pointer: 0x7e4cf0e78210

Have you verified that you are using the correct version of Android? The correct version of the NDK? The correct ABI for your device?

I am happy to help you, but I will need more information.

Tunshutegong commented 1 month ago

It's my fault. I executed setFrameEncryptor when initializing PeerConnection and setFrameDecryptor in onAddStream(). The result is that encryption was successful, but decryption was not successful. Did I use it incorrectly? I still need to keep trying. Thank you very much

blspeiser commented 1 month ago

Glad to hear that your encryption was successful!

The android-studio example code shows how to set both the encryptor and decryptor, and if you were setting it in onAddStream(), that's probably not going to work - you have to set it on the RtpReceivers attached to the PeerConnection.

Good luck!