Class AesNativeTransformer

  • All Implemented Interfaces:
    ICTRTransformer

    public class AesNativeTransformer
    extends AesCTRTransformer
    Generic Native AES transformer. Extend this with your specific native transformer.
    • Constructor Detail

      • 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 Detail

      • setNativeProxy

        public static void setNativeProxy​(INativeProxy proxy)
        The native proxy to use for loading libraries for different platforms and operating systems.
        Parameters:
        proxy - The proxy
      • getNativeProxy

        public static INativeProxy getNativeProxy()
      • getImplType

        public int getImplType()
      • setImplType

        public void setImplType​(int implType)
      • init

        public void init​(byte[] key,
                         byte[] nonce)
        Initialize the native Aes intrinsics transformer.
        Specified by:
        init in interface ICTRTransformer
        Overrides:
        init in class AesCTRTransformer
        Parameters:
        key - The AES key to use
        nonce - 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.