Class Phelix
java.lang.Object
com.coderslagoon.crypto.estreamj.ciphers.phelix.Phelix
- All Implemented Interfaces:
ICipher
The Phelix implementation, based on the original PhelixJ package by
CODERSLAGOON.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from interface com.coderslagoon.crypto.estreamj.framework.ICipher
MODE_DECRYPT, MODE_ENCRYPT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiderase()Erases all sensitive data.voidfinalize(byte[] mac, int macOfs) intintintintbooleanvoidprocess(byte[] inBuf, int inbufOfs, byte[] outBuf, int outbufOfs, int msgLen) Processes data.voidprocessAAD(byte[] aad, int aadOfs, int aadLen) static voidregister()voidreset()Resets the instance, so it can be reused.voidsetupKey(int mode, byte[] key, int keyOfs) Sets up a new key with the existing instance.voidsetupKeyEx(int mode, byte[] key, int keyOfs, int keySize) voidsetupNonce(byte[] nonce, int nonceOfs) Sets up a new nonce with the existing cipher instance.
-
Field Details
-
PHELIX_MAC_SIZE
public static final int PHELIX_MAC_SIZE- See Also:
-
PHELIX_MAC_SIZE_96
public static final int PHELIX_MAC_SIZE_96- See Also:
-
-
Constructor Details
-
Phelix
public Phelix(int macSize)
-
-
Method Details
-
erase
public void erase()Description copied from interface:ICipherErases all sensitive data. Instance MUST be abadonned afterwards. -
reset
public void reset()Description copied from interface:ICipherResets the instance, so it can be reused. -
setupKey
Description copied from interface:ICipherSets up a new key with the existing instance.- Specified by:
setupKeyin interfaceICipher- Parameters:
mode- see MODE_xxxkey- buffer with key materialkeyOfs- where the key starts- Throws:
ESJException- if any error occurs
-
setupKeyEx
- Throws:
ESJException
-
setupNonce
public void setupNonce(byte[] nonce, int nonceOfs) Description copied from interface:ICipherSets up a new nonce with the existing cipher instance.- Specified by:
setupNoncein interfaceICipher- Parameters:
nonce- buffer with nonce materialnonceOfs- where the nonce starts
-
process
public void process(byte[] inBuf, int inbufOfs, byte[] outBuf, int outbufOfs, int msgLen) throws ESJException Description copied from interface:ICipherProcesses data.- Specified by:
processin interfaceICipher- Parameters:
inBuf- input bufferinbufOfs- where to start reading from the input bufferoutBuf- output bufferoutbufOfs- where to start writing in the output buffermsgLen- number of bytes to process, must be aligned to the cipher's word size except on the last call where an arbitrary size can be used- Throws:
ESJException- in any error occurred
-
processAAD
- Throws:
ESJException
-
finalize
public void finalize(byte[] mac, int macOfs) -
getKeySize
public int getKeySize()- Specified by:
getKeySizein interfaceICipher- Returns:
- key size in bytes
-
getMacSize
public int getMacSize() -
getNonceSize
public int getNonceSize()- Specified by:
getNonceSizein interfaceICipher- Returns:
- nonce size in bytes.
-
getWordSize
public int getWordSize()- Specified by:
getWordSizein interfaceICipher- Returns:
- alignment of data needed during calls into process()
-
isPatented
public boolean isPatented()- Specified by:
isPatentedin interfaceICipher- Returns:
- true: algorithm is patented, check with vendor for license details / false: free to use in private and commercial applications
-
register
public static void register()
-