views:

145

answers:

1

Hello I want to implement a IPSEC protocol in java. I want to know how to create our own protocol. And how to embedded this protocol with packet.

Please provide some code example so that it is easy to understand.

+1  A: 

IPSec is a internet layer protocol, not an application layer protocol. It works by encrypting/securing each network packet and as such runs at the network card level, usually by an OS provided driver which makes its use transparent to any applications.

It is not something you implement in your own code, instead if you wanted application level security you'd look at TLS/SSL or something more specific to your communications protocol.

blowdart
Yes i know that.But in IPSEC there is a AH header.In that header there are sequence number.Actually i want to implement this sequence number.so that we can accept only those packet that have not recieved yet.
Anant
This is not up to you - IPSEC is supposed to be transparent, it's not for applications to use - you can't packet capture in Java or any managed language properly.
blowdart
@Anant -- Can you augment your question with these specifics, and state what you need the seq number for? As @blowdart suggests, you should never see separately resolvable IPSEC packets at the Java level such that you could make that decision (unless you've already got a mechanism in place to forward raw packets up to that level for inspection...)
andersoj
Actually my primary requirement is that i want to implement something so that i can sent a packet to another destination.when the destination recieve the packet it check its sequence number and if the sequence number is already there discard that packet and if the sequence number is new accept the packet.
Anant
@Anant: The IP/IPSec layer in your OS does that for you (and generally discourages you from knowing about the details). Are you in an OS that doesn't provide IPSec? If so, probably want to reframe the question in that context.
andersoj