in src/main/java/org/apache/commons/crypto/jna/LibreSsl20XNativeJna.java [218:306]
public static native int EVP_CipherFinal_ex(PointerByReference ctx, ByteBuffer bout,
int[] outl);
/**
* Init a cipher.
*
* @param ctx
* cipher context
* @param cipher
* evp cipher instance
* @param impl
* engine
* @param key
* key
* @param iv
* iv
* @param enc
* 1 for encryption, 0 for decryption
* @return 1 for success and 0 for failure.
*/
public static native int EVP_CipherInit_ex(PointerByReference ctx, PointerByReference cipher,
PointerByReference impl, byte[] key, byte[] iv, int enc);
// ENGINE API: https://www.openssl.org/docs/man1.0.2/man3/engine.html
/**
* Continues a multiple-part encryption/decryption operation.
*
* @param ctx
* cipher context
* @param bout
* output byte buffer
* @param outl
* output length
* @param in
* input byte buffer
* @param inl
* input length
* @return 1 for success and 0 for failure.
*/
public static native int EVP_CipherUpdate(PointerByReference ctx, ByteBuffer bout, int[] outl,
ByteBuffer in, int inl);
/**
* Generates random data
*
* @param buf
* the bytes for generated random.
* @param num
* buffer length
* @return 1 on success, 0 otherwise.
*/
public static native int RAND_bytes(ByteBuffer buf, int num);
// Random generator
/**
* OpenSSL uses for random number generation
*
* @return pointers to the respective methods
*/
public static native PointerByReference RAND_get_rand_method();
/**
* OpenSSL uses for random number generation.
*
* @return pointers to the respective methods.
*/
public static native PointerByReference RAND_SSLeay();
/**
* @return OPENSSL_VERSION_NUMBER which is a numeric release version identifier
*/
public static native NativeLong SSLeay();
/**
* Retrieves version/build information about OpenSSL library.
* This is returned by {@link OpenSslNativeJna#OpenSSLVersion(int)}
*
* @param type
* type can be SSLEAY_VERSION, SSLEAY_CFLAGS, SSLEAY_BUILT_ON...
* @return A pointer to a constant string describing the version of the OpenSSL library or
* giving information about the library build.
*/
public static native String SSLeay_version(int type);
@Override
public PointerByReference _ENGINE_by_id(final String string) {
return ENGINE_by_id(string);
}