All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.virgilsecurity.crypto.virgil_crypto_javaJNI Maven / Gradle / Ivy

Go to download

Virgil is a stack of security libraries (ECIES with Crypto Agility wrapped in Virgil Cryptogram) and all the necessary infrastructure to enable seamless, end-to-end encryption for any application, platform or device. Learn about Virgil Crypto Library https://virgilsecurity.com/api-docs/java-android/crypto-library

There is a newer version: 7.3.2
Show newest version
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.12
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.virgilsecurity.crypto;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class virgil_crypto_javaJNI {
	public final static native long VirgilVersion_asNumber();

	public final static native String VirgilVersion_asString();

	public final static native long VirgilVersion_majorVersion();

	public final static native long VirgilVersion_minorVersion();

	public final static native long VirgilVersion_patchVersion();

	public final static native String VirgilVersion_fullName();

	public final static native long new_VirgilVersion();

	public final static native void delete_VirgilVersion(long jarg1);

	public final static native boolean VirgilDataSource_hasData(long jarg1, VirgilDataSource jarg1_)
			throws java.io.IOException;

	public final static native byte[] VirgilDataSource_read(long jarg1, VirgilDataSource jarg1_)
			throws java.io.IOException;

	public final static native void delete_VirgilDataSource(long jarg1);

	public final static native long new_VirgilDataSource();

	public final static native void VirgilDataSource_director_connect(VirgilDataSource obj, long cptr, boolean mem_own,
			boolean weak_global);

	public final static native void VirgilDataSource_change_ownership(VirgilDataSource obj, long cptr,
			boolean take_or_release);

	public final static native boolean VirgilDataSink_isGood(long jarg1, VirgilDataSink jarg1_)
			throws java.io.IOException;

	public final static native void VirgilDataSink_write(long jarg1, VirgilDataSink jarg1_, byte[] jarg2)
			throws java.io.IOException;

	public final static native void delete_VirgilDataSink(long jarg1);

	public final static native long new_VirgilDataSink();

	public final static native void VirgilDataSink_director_connect(VirgilDataSink obj, long cptr, boolean mem_own,
			boolean weak_global);

	public final static native void VirgilDataSink_change_ownership(VirgilDataSink obj, long cptr,
			boolean take_or_release);

	public final static native byte[] VirgilAsn1Compatible_toAsn1(long jarg1, VirgilAsn1Compatible jarg1_);

	public final static native void VirgilAsn1Compatible_fromAsn1(long jarg1, VirgilAsn1Compatible jarg1_,
			byte[] jarg2);

	public final static native void delete_VirgilAsn1Compatible(long jarg1);

	public final static native long VirgilHash_md5();

	public final static native long VirgilHash_sha256();

	public final static native long VirgilHash_sha384();

	public final static native long VirgilHash_sha512();

	public final static native long VirgilHash_withName(byte[] jarg1);

	public final static native long new_VirgilHash__SWIG_0();

	public final static native void delete_VirgilHash(long jarg1);

	public final static native String VirgilHash_name(long jarg1, VirgilHash jarg1_);

	public final static native int VirgilHash_type(long jarg1, VirgilHash jarg1_);

	public final static native byte[] VirgilHash_hash(long jarg1, VirgilHash jarg1_, byte[] jarg2);

	public final static native void VirgilHash_start(long jarg1, VirgilHash jarg1_);

	public final static native void VirgilHash_update(long jarg1, VirgilHash jarg1_, byte[] jarg2);

	public final static native byte[] VirgilHash_finish(long jarg1, VirgilHash jarg1_);

	public final static native byte[] VirgilHash_hmac(long jarg1, VirgilHash jarg1_, byte[] jarg2, byte[] jarg3);

	public final static native void VirgilHash_hmacStart(long jarg1, VirgilHash jarg1_, byte[] jarg2);

	public final static native void VirgilHash_hmacReset(long jarg1, VirgilHash jarg1_);

	public final static native void VirgilHash_hmacUpdate(long jarg1, VirgilHash jarg1_, byte[] jarg2);

	public final static native byte[] VirgilHash_hmacFinish(long jarg1, VirgilHash jarg1_);

	public final static native long new_VirgilHash__SWIG_1(long jarg1, VirgilHash jarg1_);

	public final static native String VirgilBase64_encode(byte[] jarg1);

	public final static native byte[] VirgilBase64_decode(String jarg1);

	public final static native long new_VirgilBase64();

	public final static native void delete_VirgilBase64(long jarg1);

	public final static native long VirgilPBKDF_kIterationCount_Default_get();

	public final static native int VirgilPBKDF_None_get();

	public final static native int VirgilPBKDF_SHA1_get();

	public final static native long new_VirgilPBKDF__SWIG_0();

	public final static native long new_VirgilPBKDF__SWIG_1(byte[] jarg1, long jarg2);

	public final static native long new_VirgilPBKDF__SWIG_2(byte[] jarg1);

	public final static native void delete_VirgilPBKDF(long jarg1);

	public final static native byte[] VirgilPBKDF_getSalt(long jarg1, VirgilPBKDF jarg1_);

	public final static native long VirgilPBKDF_getIterationCount(long jarg1, VirgilPBKDF jarg1_);

	public final static native void VirgilPBKDF_setAlgorithm(long jarg1, VirgilPBKDF jarg1_, int jarg2);

	public final static native int VirgilPBKDF_getAlgorithm(long jarg1, VirgilPBKDF jarg1_);

	public final static native void VirgilPBKDF_setHash(long jarg1, VirgilPBKDF jarg1_, int jarg2);

	public final static native int VirgilPBKDF_getHash(long jarg1, VirgilPBKDF jarg1_);

	public final static native void VirgilPBKDF_enableRecommendationsCheck(long jarg1, VirgilPBKDF jarg1_);

	public final static native void VirgilPBKDF_disableRecommendationsCheck(long jarg1, VirgilPBKDF jarg1_);

	public final static native byte[] VirgilPBKDF_derive__SWIG_0(long jarg1, VirgilPBKDF jarg1_, byte[] jarg2,
			long jarg3);

	public final static native byte[] VirgilPBKDF_derive__SWIG_1(long jarg1, VirgilPBKDF jarg1_, byte[] jarg2);

	public final static native boolean VirgilCustomParams_isEmpty(long jarg1, VirgilCustomParams jarg1_);

	public final static native void VirgilCustomParams_setInteger(long jarg1, VirgilCustomParams jarg1_, byte[] jarg2,
			int jarg3);

	public final static native int VirgilCustomParams_getInteger(long jarg1, VirgilCustomParams jarg1_, byte[] jarg2);

	public final static native void VirgilCustomParams_removeInteger(long jarg1, VirgilCustomParams jarg1_,
			byte[] jarg2);

	public final static native void VirgilCustomParams_setString(long jarg1, VirgilCustomParams jarg1_, byte[] jarg2,
			byte[] jarg3);

	public final static native byte[] VirgilCustomParams_getString(long jarg1, VirgilCustomParams jarg1_, byte[] jarg2);

	public final static native void VirgilCustomParams_removeString(long jarg1, VirgilCustomParams jarg1_,
			byte[] jarg2);

	public final static native void VirgilCustomParams_setData(long jarg1, VirgilCustomParams jarg1_, byte[] jarg2,
			byte[] jarg3);

	public final static native byte[] VirgilCustomParams_getData(long jarg1, VirgilCustomParams jarg1_, byte[] jarg2);

	public final static native void VirgilCustomParams_removeData(long jarg1, VirgilCustomParams jarg1_, byte[] jarg2);

	public final static native void VirgilCustomParams_clear(long jarg1, VirgilCustomParams jarg1_);

	public final static native void delete_VirgilCustomParams(long jarg1);

	public final static native long new_VirgilCustomParams__SWIG_0();

	public final static native long new_VirgilCustomParams__SWIG_1(long jarg1, VirgilCustomParams jarg1_);

	public final static native int VirgilKeyPair_Default_get();

	public final static native int VirgilKeyPair_EC_Curve25519_get();

	public final static native long VirgilKeyPair_generate__SWIG_0(int jarg1, byte[] jarg2);

	public final static native long VirgilKeyPair_generate__SWIG_1(int jarg1);

	public final static native long VirgilKeyPair_generate__SWIG_2();

	public final static native long VirgilKeyPair_ecNist192__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecNist192__SWIG_1();

	public final static native long VirgilKeyPair_ecNist224__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecNist224__SWIG_1();

	public final static native long VirgilKeyPair_ecNist256__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecNist256__SWIG_1();

	public final static native long VirgilKeyPair_ecNist384__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecNist384__SWIG_1();

	public final static native long VirgilKeyPair_ecNist521__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecNist521__SWIG_1();

	public final static native long VirgilKeyPair_ecBrainpool256__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecBrainpool256__SWIG_1();

	public final static native long VirgilKeyPair_ecBrainpool384__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecBrainpool384__SWIG_1();

	public final static native long VirgilKeyPair_ecBrainpool512__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecBrainpool512__SWIG_1();

	public final static native long VirgilKeyPair_ecKoblitz192__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecKoblitz192__SWIG_1();

	public final static native long VirgilKeyPair_ecKoblitz224__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecKoblitz224__SWIG_1();

	public final static native long VirgilKeyPair_ecKoblitz256__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_ecKoblitz256__SWIG_1();

	public final static native long VirgilKeyPair_rsa256__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_rsa256__SWIG_1();

	public final static native long VirgilKeyPair_rsa512__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_rsa512__SWIG_1();

	public final static native long VirgilKeyPair_rsa1024__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_rsa1024__SWIG_1();

	public final static native long VirgilKeyPair_rsa2048__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_rsa2048__SWIG_1();

	public final static native long VirgilKeyPair_rsa4096__SWIG_0(byte[] jarg1);

	public final static native long VirgilKeyPair_rsa4096__SWIG_1();

	public final static native boolean VirgilKeyPair_isKeyPairMatch__SWIG_0(byte[] jarg1, byte[] jarg2, byte[] jarg3);

	public final static native boolean VirgilKeyPair_isKeyPairMatch__SWIG_1(byte[] jarg1, byte[] jarg2);

	public final static native boolean VirgilKeyPair_checkPrivateKeyPassword(byte[] jarg1, byte[] jarg2);

	public final static native boolean VirgilKeyPair_isPrivateKeyEncrypted(byte[] jarg1);

	public final static native byte[] VirgilKeyPair_resetPrivateKeyPassword(byte[] jarg1, byte[] jarg2, byte[] jarg3);

	public final static native long new_VirgilKeyPair__SWIG_0(byte[] jarg1);

	public final static native long new_VirgilKeyPair__SWIG_1();

	public final static native long new_VirgilKeyPair__SWIG_2(byte[] jarg1, byte[] jarg2);

	public final static native byte[] VirgilKeyPair_publicKey(long jarg1, VirgilKeyPair jarg1_);

	public final static native byte[] VirgilKeyPair_privateKey(long jarg1, VirgilKeyPair jarg1_);

	public final static native long new_VirgilKeyPair__SWIG_3(long jarg1, VirgilKeyPair jarg1_);

	public final static native void delete_VirgilKeyPair(long jarg1);

	public final static native long new_VirgilCipherBase();

	public final static native void delete_VirgilCipherBase(long jarg1);

	public final static native void VirgilCipherBase_addKeyRecipient(long jarg1, VirgilCipherBase jarg1_, byte[] jarg2,
			byte[] jarg3);

	public final static native void VirgilCipherBase_removeKeyRecipient(long jarg1, VirgilCipherBase jarg1_,
			byte[] jarg2);

	public final static native boolean VirgilCipherBase_keyRecipientExists(long jarg1, VirgilCipherBase jarg1_,
			byte[] jarg2);

	public final static native void VirgilCipherBase_addPasswordRecipient(long jarg1, VirgilCipherBase jarg1_,
			byte[] jarg2);

	public final static native void VirgilCipherBase_removePasswordRecipient(long jarg1, VirgilCipherBase jarg1_,
			byte[] jarg2);

	public final static native void VirgilCipherBase_removeAllRecipients(long jarg1, VirgilCipherBase jarg1_);

	public final static native byte[] VirgilCipherBase_getContentInfo(long jarg1, VirgilCipherBase jarg1_);

	public final static native void VirgilCipherBase_setContentInfo(long jarg1, VirgilCipherBase jarg1_, byte[] jarg2);

	public final static native long VirgilCipherBase_defineContentInfoSize(byte[] jarg1);

	public final static native long VirgilCipherBase_customParams__SWIG_0(long jarg1, VirgilCipherBase jarg1_);

	public final static native void delete_VirgilCipher(long jarg1);

	public final static native byte[] VirgilCipher_encrypt__SWIG_0(long jarg1, VirgilCipher jarg1_, byte[] jarg2,
			boolean jarg3);

	public final static native byte[] VirgilCipher_encrypt__SWIG_1(long jarg1, VirgilCipher jarg1_, byte[] jarg2);

	public final static native byte[] VirgilCipher_decryptWithKey__SWIG_0(long jarg1, VirgilCipher jarg1_, byte[] jarg2,
			byte[] jarg3, byte[] jarg4, byte[] jarg5);

	public final static native byte[] VirgilCipher_decryptWithKey__SWIG_1(long jarg1, VirgilCipher jarg1_, byte[] jarg2,
			byte[] jarg3, byte[] jarg4);

	public final static native byte[] VirgilCipher_decryptWithPassword(long jarg1, VirgilCipher jarg1_, byte[] jarg2,
			byte[] jarg3);

	public final static native long new_VirgilCipher();

	public final static native int VirgilChunkCipher_kPreferredChunkSize_get();

	public final static native long VirgilChunkCipher_startEncryption__SWIG_0(long jarg1, VirgilChunkCipher jarg1_,
			long jarg2);

	public final static native long VirgilChunkCipher_startEncryption__SWIG_1(long jarg1, VirgilChunkCipher jarg1_);

	public final static native long VirgilChunkCipher_startDecryptionWithKey__SWIG_0(long jarg1,
			VirgilChunkCipher jarg1_, byte[] jarg2, byte[] jarg3, byte[] jarg4);

	public final static native long VirgilChunkCipher_startDecryptionWithKey__SWIG_1(long jarg1,
			VirgilChunkCipher jarg1_, byte[] jarg2, byte[] jarg3);

	public final static native long VirgilChunkCipher_startDecryptionWithPassword(long jarg1, VirgilChunkCipher jarg1_,
			byte[] jarg2);

	public final static native byte[] VirgilChunkCipher_process(long jarg1, VirgilChunkCipher jarg1_, byte[] jarg2);

	public final static native void VirgilChunkCipher_finish(long jarg1, VirgilChunkCipher jarg1_);

	public final static native void delete_VirgilChunkCipher(long jarg1);

	public final static native long new_VirgilChunkCipher();

	public final static native long new_VirgilSigner__SWIG_0(long jarg1, VirgilHash jarg1_);

	public final static native long new_VirgilSigner__SWIG_1();

	public final static native byte[] VirgilSigner_sign__SWIG_0(long jarg1, VirgilSigner jarg1_, byte[] jarg2,
			byte[] jarg3, byte[] jarg4);

	public final static native byte[] VirgilSigner_sign__SWIG_1(long jarg1, VirgilSigner jarg1_, byte[] jarg2,
			byte[] jarg3);

	public final static native boolean VirgilSigner_verify(long jarg1, VirgilSigner jarg1_, byte[] jarg2, byte[] jarg3,
			byte[] jarg4);

	public final static native void delete_VirgilSigner(long jarg1);

	public final static native long new_VirgilStreamSigner__SWIG_0(long jarg1, VirgilHash jarg1_);

	public final static native long new_VirgilStreamSigner__SWIG_1();

	public final static native byte[] VirgilStreamSigner_sign__SWIG_0(long jarg1, VirgilStreamSigner jarg1_, long jarg2,
			VirgilDataSource jarg2_, byte[] jarg3, byte[] jarg4);

	public final static native byte[] VirgilStreamSigner_sign__SWIG_1(long jarg1, VirgilStreamSigner jarg1_, long jarg2,
			VirgilDataSource jarg2_, byte[] jarg3);

	public final static native boolean VirgilStreamSigner_verify(long jarg1, VirgilStreamSigner jarg1_, long jarg2,
			VirgilDataSource jarg2_, byte[] jarg3, byte[] jarg4);

	public final static native void delete_VirgilStreamSigner(long jarg1);

	public final static native void delete_VirgilStreamCipher(long jarg1);

	public final static native void VirgilStreamCipher_encrypt__SWIG_0(long jarg1, VirgilStreamCipher jarg1_,
			long jarg2, VirgilDataSource jarg2_, long jarg3, VirgilDataSink jarg3_, boolean jarg4);

	public final static native void VirgilStreamCipher_encrypt__SWIG_1(long jarg1, VirgilStreamCipher jarg1_,
			long jarg2, VirgilDataSource jarg2_, long jarg3, VirgilDataSink jarg3_);

	public final static native void VirgilStreamCipher_decryptWithKey__SWIG_0(long jarg1, VirgilStreamCipher jarg1_,
			long jarg2, VirgilDataSource jarg2_, long jarg3, VirgilDataSink jarg3_, byte[] jarg4, byte[] jarg5,
			byte[] jarg6);

	public final static native void VirgilStreamCipher_decryptWithKey__SWIG_1(long jarg1, VirgilStreamCipher jarg1_,
			long jarg2, VirgilDataSource jarg2_, long jarg3, VirgilDataSink jarg3_, byte[] jarg4, byte[] jarg5);

	public final static native void VirgilStreamCipher_decryptWithPassword(long jarg1, VirgilStreamCipher jarg1_,
			long jarg2, VirgilDataSource jarg2_, long jarg3, VirgilDataSink jarg3_, byte[] jarg4);

	public final static native long new_VirgilStreamCipher();

	public final static native byte[] VirgilByteArrayUtils_jsonToBytes(String jarg1);

	public final static native byte[] VirgilByteArrayUtils_stringToBytes(String jarg1);

	public final static native String VirgilByteArrayUtils_bytesToString(byte[] jarg1);

	public final static native byte[] VirgilByteArrayUtils_hexToBytes(String jarg1);

	public final static native String VirgilByteArrayUtils_bytesToHex__SWIG_0(byte[] jarg1, boolean jarg2);

	public final static native String VirgilByteArrayUtils_bytesToHex__SWIG_1(byte[] jarg1);

	public final static native void delete_VirgilByteArrayUtils(long jarg1);

	public final static native long VirgilHash_SWIGUpcast(long jarg1);

	public final static native long VirgilPBKDF_SWIGUpcast(long jarg1);

	public final static native long VirgilCustomParams_SWIGUpcast(long jarg1);

	public final static native long VirgilCipher_SWIGUpcast(long jarg1);

	public final static native long VirgilChunkCipher_SWIGUpcast(long jarg1);

	public final static native long VirgilStreamCipher_SWIGUpcast(long jarg1);

	public static boolean SwigDirector_VirgilDataSource_hasData(VirgilDataSource self) throws java.io.IOException {
		return self.hasData();
	}

	public static byte[] SwigDirector_VirgilDataSource_read(VirgilDataSource self) throws java.io.IOException {
		return self.read();
	}

	public static boolean SwigDirector_VirgilDataSink_isGood(VirgilDataSink self) throws java.io.IOException {
		return self.isGood();
	}

	public static void SwigDirector_VirgilDataSink_write(VirgilDataSink self, byte[] data) throws java.io.IOException {
		self.write(data);
	}

	private final static native void swig_module_init();

	static {
		try {
			loadNativeLibrary("virgil_crypto_java");
		} catch (Exception error) {
			System.err.println("Native code library failed to load. \n" + error);
		}
		swig_module_init();
	}

	public static void loadNativeLibrary(String libraryName) throws IOException {

		try {
			System.loadLibrary(libraryName);
			// Library is loaded (Android). We can exit
			return;
		} catch (Throwable e) {
			// Library couldn't be loaded (non-Android). We'll load it later.
		}

		// Build native library name according to current system
		String osName = System.getProperty("os.name").toLowerCase();
		String osArch = System.getProperty("os.arch").toLowerCase();

		StringBuilder resourceName = new StringBuilder();
		for (String os : new String[] { "linux", "windows", "mac os" }) {
			if (osName.startsWith(os)) {
				resourceName.append(os);

				if ("windows".equals(os)) {
					resourceName.append(File.separator).append(osArch);
				}

				break;
			}
		}
		resourceName.append(File.separator).append(libraryName);

		InputStream in = virgil_crypto_javaJNI.class.getClassLoader().getResourceAsStream(resourceName.toString());
		if (in == null) {
			throw new FileNotFoundException("Resource '" + resourceName.toString() + "' not found");
		}

		byte[] buffer = new byte[1024];
		int read = -1;
		File temp = File.createTempFile(libraryName, "");
		FileOutputStream fos = new FileOutputStream(temp);

		while ((read = in.read(buffer)) != -1) {
			fos.write(buffer, 0, read);
		}
		fos.close();
		in.close();

		System.load(temp.getAbsolutePath());
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy