Package com.mku.salmon.transform
Class AesNativeTransformer
java.lang.Object
com.mku.salmon.transform.AesCTRTransformer
com.mku.salmon.transform.AesNativeTransformer
- All Implemented Interfaces:
ICTRTransformer
Generic Native AES transformer. Extend this with your specific
native transformer.
-
Field Summary
Fields inherited from class com.mku.salmon.transform.AesCTRTransformer
BLOCK_SIZE, EXPANDED_KEY_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionAesNativeTransformer(int implType) Construct a SalmonNativeTransformer for using the native aes c library -
Method Summary
Modifier and TypeMethodDescriptionintdecryptData(byte[] srcBuffer, int srcOffset, byte[] destBuffer, int destOffset, int count) Decrypt the data.intencryptData(byte[] srcBuffer, int srcOffset, byte[] destBuffer, int destOffset, int count) Encrypt the data.intGet the AES native implementation type, see enum class ProviderTypestatic INativeProxyGet the AES native proxyvoidinit(byte[] key, byte[] nonce) Initialize the native Aes intrinsics transformer.voidsetImplType(int implType) Set the AES native implementation type, see enum class ProviderTypestatic voidsetNativeProxy(INativeProxy proxy) The native proxy to use for loading libraries for different platforms and operating systems.Methods inherited from class com.mku.salmon.transform.AesCTRTransformer
getBlock, getCounter, getExpandedKey, getKey, getNonce, increaseCounter, resetCounter, setExpandedKey, syncCounter
-
Constructor Details
-
AesNativeTransformer
public AesNativeTransformer(int implType) Construct a SalmonNativeTransformer for using the native aes c library- Parameters:
implType- The AES native implementation see ProviderType enum
-
-
Method Details
-
setNativeProxy
The native proxy to use for loading libraries for different platforms and operating systems.- Parameters:
proxy- The proxy
-
getNativeProxy
Get the AES native proxy- Returns:
- The native proxy
-
getImplType
public int getImplType()Get the AES native implementation type, see enum class ProviderType- Returns:
- The implementation type
-
setImplType
public void setImplType(int implType) Set the AES native implementation type, see enum class ProviderType- Parameters:
implType- The implementation type
-
init
public void init(byte[] key, byte[] nonce) Initialize the native Aes intrinsics transformer.- Specified by:
initin interfaceICTRTransformer- Overrides:
initin classAesCTRTransformer- Parameters:
key- The AES key to usenonce- The nonce to use
-
encryptData
public int encryptData(byte[] srcBuffer, int srcOffset, byte[] destBuffer, int destOffset, int count) Encrypt the data.- Parameters:
srcBuffer- The source byte array.srcOffset- The source byte offset.destBuffer- The destination byte array.destOffset- The destination byte offset.count- The number of bytes to transform.- Returns:
- The number of bytes transformed.
-
decryptData
public int decryptData(byte[] srcBuffer, int srcOffset, byte[] destBuffer, int destOffset, int count) Decrypt the data.- Parameters:
srcBuffer- The source byte array.srcOffset- The source byte offset.destBuffer- The destination byte array.destOffset- The destination byte offset.count- The number of bytes to transform.- Returns:
- The number of bytes transformed.
-