Hi all,
First of all please read the full article and then try to suggest me...
I want to make a java project on streaming video encryption. Where i will use two PCs 1 act like a media server and other act like a client. So a video file (example.avi) in server pc can be view by client pc.
I already worked with sockets and can send files over a LAN. But here my question is ->
I want to send the encrypted video Stream to the client PC and the Client then display the video.
The process is like.
*Client request a video file
*Server open the video file (in text mode or something else) and start encrypting and sending to client.
*Now client start receving and decrypting the data.
*And display the decrypted data as video
in details
Server
*Connected to client
*Open the video file
*While Not EOF
*Read file content block
*Encrypt it
*Send encrypted block to the client
*End While
Client
*Connected to server
*While True(Or something like that)
*Store the received encrypted data
*Decrypt it
*Display it as video
*End While
I do not need any source code for that. I just want to know that from where i can start this project. Any suggesstion will be helpful for me.
*Can connect two pc
*Can read files
*Can encrypt
*Can send data over LAN
*Can decrypt it
But how can i use the decrypted data and display it as video.
Thanks in advance..

Dani AI

Generated

— since you confirmed you want simultaneous (play‑while‑download) playback (as asked), treat this as a streaming problem, not a plain file copy. Two practical, well-tested paths work best.

  1. Transport encryption (simplest): run a normal streaming endpoint and secure the transport with TLS. In Java you can use SSLServerSocket / SSLSocket or HTTPS; the video bytes stay in a standard container and a player that accepts a URI can start playback immediately. This avoids reimplementing crypto and key exchange. See the Java SSL socket API for details. (JavaFX Media supports HTTP/HLS URIs rather than raw InputStreams.)
    (See: Java SSLSocket docs: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/javax/net/ssl/SSLServerSocket.html and JavaFX media overview: https://docs.oracle.com/javase/8/javafx/media-tutorial/overview.htm)

  2. Application‑level encryption (more control, more work): segment the stream (small segments or fragmented MP4 / MPEG‑TS) and encrypt each segment with a streaming‑friendly cipher (AES‑GCM or AES‑CTR with a unique IV per segment). Use a standard segmenting/container format (HLS / CMAF / MPEG‑TS) so the client can begin playback on each decrypted segment. Be careful: GCM gives authentication tags and needs non‑repeating IVs — follow the NIST guidance for GCM IV/tag rules. For playback in Java, either:

Quick practical steps

  • Get an unencrypted streaming prototype working first (HLS/HTTP or RTP).
  • If using JavaFX MediaPlayer, serve a URL (JavaFX expects file/HTTP/HLS URIs).
  • If you need in‑memory feeding (no files), use GStreamer or vlcj which let you push decrypted buffers.
  • Use short segments (2–4s or less for low latency), rotate IVs/keys per segment, and perform key exchange over TLS or an authenticated handshake.

Troubleshooting tips: test with VLC/ffmpeg first, watch buffer sizes and timestamps (audio/video sync), and verify IV/tag handling — a single bad nonce will break decryption/authentication for that stream.

Recommended Answers

All 2 Replies

One small clarification . Do you want to play the video simultanerously at client side when the video is being transferred? or else do you want to play the video after complete transfer of video?

Yes I want to play the video simultanerously at client side when the video is being transferred.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.