public class LegacyBlowfishCipher extends Object implements SocketCipher
Modifier and Type | Field and Description |
---|---|
static String |
HASH_KEY
The Key for encryption.
|
Constructor and Description |
---|
LegacyBlowfishCipher() |
Modifier and Type | Method and Description |
---|---|
SocketCipher |
acceptedSocket(Socket socket)
Used to set the socket, specially to add the accepted socket.
|
Socket |
createClientSocket(InetAddress host,
int port)
Create and connect a
Socket . |
ServerSocket |
createServerSocket(int port,
int backlog,
InetAddress ifAddress)
Create a
ServerSocket . |
Message |
readMessage()
Read data from a stream and decrypt it and convert to a
Message . |
boolean |
sendMessage(Message m)
This method encrypt and send the given data by adding at the begging of
the encrypted data the length of the data that will be sent
|
boolean |
setup(Properties props)
Set up the Cipher with the properties.
|
public static final String HASH_KEY
public boolean setup(Properties props)
setup
in interface SocketCipher
public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress) throws IOException
ServerSocket
.createServerSocket
in interface SocketCipher
port
- the port to listen to.backlog
- the number of allowed pending connections.ifAddress
- the address to which to bind.IOException
ServerSocketFactory.createServerSocket(int, int, InetAddress)
public SocketCipher acceptedSocket(Socket socket)
acceptedSocket
in interface SocketCipher
public Socket createClientSocket(InetAddress host, int port) throws IOException
Socket
. Automatically
sets the Socket
.createClientSocket
in interface SocketCipher
host
- The address of the server.port
- The port of the server.IOException
SocketFactory.createSocket(InetAddress, int)
public boolean sendMessage(Message m) throws org.bouncycastle.crypto.CryptoException, IOException
sendMessage
in interface SocketCipher
m
- message to be sent.org.bouncycastle.crypto.CryptoException
EOFException
- This means the underlying socket is closed.IOException
public Message readMessage() throws org.bouncycastle.crypto.CryptoException, IOException
Message
.
The protocol read at the beginning 4 bytes representing the actual size
of the encrypted message that will follow.readMessage
in interface SocketCipher
IOException
ClassNotFoundException
org.bouncycastle.crypto.CryptoException
EOFException
- This means the underlying socket is closed.Copyright © 2018 universAAL Consortium. All rights reserved.