Package org.netxms.base
Class IceCrypto
java.lang.Object
org.netxms.base.IceCrypto
ICE encryption algorithm implementation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturn the block size, in bytes.voidclear()Clear the key schedule to prevent memory snooping.static byte[]decrypt(byte[] in, byte[] key) Encrypt data using given key.voiddecryptBlock(byte[] ciphertext, byte[] plaintext) Decrypt a block of 8 bytes of data.static byte[]encrypt(byte[] in, byte[] key) Encrypt data using given key.voidencryptBlock(byte[] plaintext, byte[] ciphertext) Encrypt a block of 8 bytes of data.intkeySize()Return the key size, in bytes.voidset(byte[] key) Set the key schedule of an ICE key.
-
Constructor Details
-
IceCrypto
public IceCrypto(int level) Create a new ICE key with the specified level.- Parameters:
level- key level
-
-
Method Details
-
set
public void set(byte[] key) Set the key schedule of an ICE key.- Parameters:
key- new key
-
clear
public void clear()Clear the key schedule to prevent memory snooping. -
encryptBlock
public void encryptBlock(byte[] plaintext, byte[] ciphertext) Encrypt a block of 8 bytes of data.- Parameters:
plaintext- unencrypted dataciphertext- buffer for encrypted data
-
decryptBlock
public void decryptBlock(byte[] ciphertext, byte[] plaintext) Decrypt a block of 8 bytes of data.- Parameters:
ciphertext- encrypted dataplaintext- buffer for decrypted data
-
keySize
public int keySize()Return the key size, in bytes.- Returns:
- key size in bytes
-
blockSize
public int blockSize()Return the block size, in bytes.- Returns:
- block size in bytes
-
encrypt
public static byte[] encrypt(byte[] in, byte[] key) Encrypt data using given key.- Parameters:
in- clear text datakey- encryption key- Returns:
- encrypted data
-
decrypt
public static byte[] decrypt(byte[] in, byte[] key) Encrypt data using given key.- Parameters:
in- encrypted datakey- encryption key- Returns:
- clear text data
-