Class NullCipher
- java.lang.Object
-
- org.activecomponents.udp.symciphers.NullCipher
-
- All Implemented Interfaces:
ISymCipher
public class NullCipher extends java.lang.Object implements ISymCipher
Implements NOP cipher, insecure since it is emitting plaintext.
-
-
Constructor Summary
Constructors Constructor Description NullCipher(byte[] key, Nonce nonce)
Creates the null cipher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
decrypt(byte[] cipher)
Decrypts a message.byte[]
decrypt(byte[] cipher, int offset, int len)
Decrypts a message.byte[]
encrypt(byte[] plain)
Encrypts a message.byte[]
encrypt(byte[] plain, int offset, int len)
Encrypts a message.
-
-
-
Constructor Detail
-
NullCipher
public NullCipher(byte[] key, Nonce nonce)
Creates the null cipher.- Parameters:
key
- Key, ignored.nonce
- Nonce, ignored.
-
-
Method Detail
-
encrypt
public byte[] encrypt(byte[] plain)
Encrypts a message.- Specified by:
encrypt
in interfaceISymCipher
- Parameters:
plain
- Plain text.- Returns:
- Cipher text.
-
encrypt
public byte[] encrypt(byte[] plain, int offset, int len)
Encrypts a message.- Specified by:
encrypt
in interfaceISymCipher
- Parameters:
plain
- Plain text.offset
- Offset where the plain text starts.len
- Length of the plain text, -1 for rest of the array.- Returns:
- Cipher text.
-
decrypt
public byte[] decrypt(byte[] cipher)
Decrypts a message.- Specified by:
decrypt
in interfaceISymCipher
- Parameters:
cipher
- Cipher text.- Returns:
- Plain text.
-
decrypt
public byte[] decrypt(byte[] cipher, int offset, int len)
Decrypts a message.- Specified by:
decrypt
in interfaceISymCipher
- Parameters:
cipher
- Cipher text.offset
- Offset where the cipher text starts.len
- Length of the cipher text, -1 for rest of the array.- Returns:
- Plain text.
-
-