Package jadex.ipc.impl.security.random
Class OpenSslAesCtr
java.lang.Object
jadex.ipc.impl.security.random.OpenSslAesCtr
Access to OpenSSL AES counter mode.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final byte[]
Empty static input buffer as sourceprotected static final com.sun.jna.ptr.IntByReference
Buffer size as C reference.protected com.sun.jna.Pointer
Current cipher context.static final String
OpenSSL Crypto lib name.static final com.sun.jna.NativeLibrary
OpenSSL Crypto lib. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static void
ERR_print_errors_fp
(com.sun.jna.Pointer fp) static com.sun.jna.Pointer
static com.sun.jna.Pointer
static com.sun.jna.Pointer
static void
EVP_CIPHER_CTX_free
(com.sun.jna.Pointer ctx) static com.sun.jna.Pointer
static int
EVP_CIPHER_CTX_set_padding
(com.sun.jna.Pointer context, int padding) static int
EVP_EncryptFinal_ex
(com.sun.jna.Pointer ctx, byte[] out, com.sun.jna.ptr.IntByReference outlen) static int
EVP_EncryptInit_ex
(com.sun.jna.Pointer context, com.sun.jna.Pointer ciphertype, com.sun.jna.Pointer impl, byte[] key, byte[] iv) static int
EVP_EncryptUpdate
(com.sun.jna.Pointer context, byte[] out, com.sun.jna.ptr.IntByReference outlen, byte[] in, int inlen) void
init
(byte[] key, byte[] iv) Initialize the cipher.static final boolean
Checks if the library is in a usable state.byte[]
Retrieves the next buffer of random values.static void
static void
OPENSSL_config
(String config_name)
-
Field Details
-
JNA_LIBRARY_NAME
OpenSSL Crypto lib name.- See Also:
-
JNA_NATIVE_LIB
public static final com.sun.jna.NativeLibrary JNA_NATIVE_LIBOpenSSL Crypto lib. -
BUFFER_INPUT
protected static final byte[] BUFFER_INPUTEmpty static input buffer as source -
BUFFER_SIZE_P
protected static final com.sun.jna.ptr.IntByReference BUFFER_SIZE_PBuffer size as C reference. -
evpCipherContext
protected com.sun.jna.Pointer evpCipherContextCurrent cipher context.
-
-
Constructor Details
-
OpenSslAesCtr
public OpenSslAesCtr()Create an instance.
-
-
Method Details
-
ERR_load_crypto_strings
public static void ERR_load_crypto_strings() -
OpenSSL_add_all_ciphers
public static void OpenSSL_add_all_ciphers() -
OPENSSL_config
-
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.
-