//Auto-generated by kalyptus. DO NOT EDIT.
#include <ksslpkcs12.h>
#include <ksmimecrypto.h>
#include <tqcstring.h>

#include <qtjava/QtSupport.h>
#include <tdejava/TDESupport.h>
#include <tdejava/KSMIMECrypto.h>

class KSMIMECryptoJBridge : public KSMIMECrypto
{
public:
	KSMIMECryptoJBridge() : KSMIMECrypto() {};
	~KSMIMECryptoJBridge() {QtSupport::qtKeyDeleted(this);}
};

JNIEXPORT jint JNICALL
Java_org_trinitydesktop_koala_KSMIMECrypto_decryptMessage(JNIEnv* env, jobject obj, jbyteArray cipherText, jobject clearText, jobject privKey)
{
static TQByteArray* _qbyteArray_cipherText = 0;
static TQCString* _qcstring_clearText = 0;
	if (_qcstring_clearText == 0) {
		_qcstring_clearText = new TQCString();
	}
	jint xret = (jint) ((KSMIMECrypto*) QtSupport::getQt(env, obj))->decryptMessage((const TQByteArray&)*(TQByteArray*) QtSupport::toTQByteArray(env, cipherText, &_qbyteArray_cipherText), (TQCString&)*(TQCString*) _qcstring_clearText, (const KSSLPKCS12&)*(const KSSLPKCS12*) QtSupport::getQt(env, privKey));
	QtSupport::fromTQCStringToStringBuffer(env, _qcstring_clearText, clearText);
	return xret;
}

JNIEXPORT void JNICALL
Java_org_trinitydesktop_koala_KSMIMECrypto_dispose(JNIEnv* env, jobject obj)
{
	Java_org_trinitydesktop_koala_KSMIMECrypto_finalize(env, obj);
	return;
}

JNIEXPORT void JNICALL
Java_org_trinitydesktop_koala_KSMIMECrypto_finalize(JNIEnv* env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (KSMIMECrypto*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_trinitydesktop_koala_KSMIMECrypto_isDisposed(JNIEnv* env, jobject obj)
{
	return (QtSupport::getQt(env, obj) == 0);
}

JNIEXPORT void JNICALL
Java_org_trinitydesktop_koala_KSMIMECrypto_newKSMIMECrypto(JNIEnv* env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KSMIMECryptoJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

