Class Sosemanuk
java.lang.Object
com.coderslagoon.crypto.estreamj.ciphers.sosemanuk.Sosemanuk
- All Implemented Interfaces:
ICipher
SOSEMANUK 128bit implementation. Based on the original Java source code (fast
variant) by Thomas Pornin. Minor changes have been made to improve the speed
and make it fit into the estreamJ engine.
-
Field Summary
Fields 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.intintintbooleanvoidprocess(byte[] inBuf, int inOfs, byte[] outBuf, int outOfs, int len) Processes data.static voidregister()voidreset()Resets the instance, so it can be reused.voidsetupKey(int mode, byte[] key, int ofs) Sets up a new key with the existing instance.voidsetupNonce(byte[] nonce, int ofs) Sets up a new nonce with the existing cipher instance.
-
Constructor Details
-
Sosemanuk
public Sosemanuk()
-
-
Method Details
-
erase
public void erase()Description copied from interface:ICipherErases all sensitive data. Instance MUST be abadonned afterwards. -
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 materialofs- where the key starts- Throws:
ESJException- if any error occurs
-
setupNonce
Description copied from interface:ICipherSets up a new nonce with the existing cipher instance.- Specified by:
setupNoncein interfaceICipher- Parameters:
nonce- buffer with nonce materialofs- where the nonce starts- Throws:
ESJException- if any error occurs
-
getKeySize
public int getKeySize()- Specified by:
getKeySizein interfaceICipher- Returns:
- key size in bytes
-
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
-
process
public void process(byte[] inBuf, int inOfs, byte[] outBuf, int outOfs, int len) throws ESJException Description copied from interface:ICipherProcesses data.- Specified by:
processin interfaceICipher- Parameters:
inBuf- input bufferinOfs- where to start reading from the input bufferoutBuf- output bufferoutOfs- where to start writing in the output bufferlen- 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
-
reset
Description copied from interface:ICipherResets the instance, so it can be reused.- Specified by:
resetin interfaceICipher- Throws:
ESJException- if any error occurs
-
register
public static void register()
-