Class OpenSslAesCtr


  • public class OpenSslAesCtr
    extends java.lang.Object
    Access to OpenSSL AES counter mode.
    • Field Detail

      • JNA_LIBRARY_NAME

        public static final java.lang.String JNA_LIBRARY_NAME
        OpenSSL Crypto lib name.
        See Also:
        Constant Field Values
      • JNA_NATIVE_LIB

        public static final com.sun.jna.NativeLibrary JNA_NATIVE_LIB
        OpenSSL Crypto lib.
      • BUFFER_INPUT

        protected static final byte[] BUFFER_INPUT
        Empty static input buffer as source
      • BUFFER_SIZE_P

        protected static final com.sun.jna.ptr.IntByReference BUFFER_SIZE_P
        Buffer size as C reference.
      • evpCipherContext

        protected com.sun.jna.Pointer evpCipherContext
        Current cipher context.
    • Constructor Detail

      • OpenSslAesCtr

        public OpenSslAesCtr()
        Create an instance.
    • Method Detail

      • ERR_load_crypto_strings

        public static void ERR_load_crypto_strings()
      • OpenSSL_add_all_ciphers

        public static void OpenSSL_add_all_ciphers()
      • OPENSSL_config

        public static void OPENSSL_config​(java.lang.String config_name)
      • EVP_CIPHER_CTX_new

        public static com.sun.jna.Pointer EVP_CIPHER_CTX_new()
      • EVP_CIPHER_CTX_free

        public static void EVP_CIPHER_CTX_free​(com.sun.jna.Pointer ctx)
      • EVP_CIPHER_CTX_set_padding

        public static int EVP_CIPHER_CTX_set_padding​(com.sun.jna.Pointer context,
                                                     int padding)
      • EVP_aes_256_ctr

        public static com.sun.jna.Pointer EVP_aes_256_ctr()
      • EVP_aes_128_ctr

        public static com.sun.jna.Pointer EVP_aes_128_ctr()
      • EVP_aes_256_ecb

        public static com.sun.jna.Pointer EVP_aes_256_ecb()
      • EVP_EncryptInit_ex

        public static int EVP_EncryptInit_ex​(com.sun.jna.Pointer context,
                                             com.sun.jna.Pointer ciphertype,
                                             com.sun.jna.Pointer impl,
                                             byte[] key,
                                             byte[] iv)
      • EVP_EncryptUpdate

        public static int EVP_EncryptUpdate​(com.sun.jna.Pointer context,
                                            byte[] out,
                                            com.sun.jna.ptr.IntByReference outlen,
                                            byte[] in,
                                            int inlen)
      • EVP_EncryptFinal_ex

        public static int EVP_EncryptFinal_ex​(com.sun.jna.Pointer ctx,
                                              byte[] out,
                                              com.sun.jna.ptr.IntByReference outlen)
      • ERR_print_errors_fp

        public static void ERR_print_errors_fp​(com.sun.jna.Pointer fp)
      • isEnabled

        public static final boolean isEnabled()
        Checks if the library is in a usable state.
      • init

        public void init​(byte[] key,
                         byte[] iv)
        Initialize the cipher.
        Parameters:
        key - The key.
        iv - The IV to use.
      • nextBytes

        public byte[] nextBytes()
        Retrieves the next buffer of random values.
        Returns:
        The next buffer of random values.