Secure JXTA Pipes

In our previous examples, we used an unsecure unicast pipe to transmit messages between peers. Such pipes have three potential problems:

  • Data on the pipe is sent in the clear. People who can tap into the network can read data that is transmitted on the pipe.

  • Data on the pipe may flow through a computer that modifies the data in transit.

  • There is no assurance that a pipe is connected to who you think: the peer may identify itself as O’Reilly & Associates but may in fact be someone else.

Secure pipes overcome these limitations by using digitally signed data to identify the peers connected to them. Also, they encrypt data that flows through them. The signature verifies the identity of the connected peer; the encryption prevents data from being read or modified in transit.

JXTA Java bindings implement secure pipes using Transport Layer Security (TLS). TLS is compatible with the Secure Socket Layer (SSL) protocol. The SSL protocol was developed by Netscape Communications and went through several versions. Version 3.0 of SSL was contributed to the Internet Engineering Task Force (IETF), which made slight modifications to the protocol and issued the TLS 1.0 specification. TLS implementations are backwards-compatible with SSL 3.0.

When you want to create a secure pipe, set its type like this:

myAdv.setType(PipeService.UnicastSecureType);

TLS pipes have the following advantages:

  • Data sent over the pipe is encrypted; it cannot be read or modified in transit. ...

Get JXTA in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.