/***************************************************************************
                            kde_KSSLCertificate.cpp -  description
                             -------------------
    begin                : Wed Feb  6 15:12:26 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Feb  6 15:12:26 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

extern "C" {
#include "kde_KSSLCertificate.h"
}

#include <qstring.h>
#include <qdatetime.h>
#include <ksslcertificate.h>

class KSSLCertificateBridge : public KSSLCertificate
{
public:
	~KSSLCertificateBridge() {}
	KSSLCertificateBridge(const KSSLCertificate& x) : KSSLCertificate(x) {}
	KSSLCertificateBridge() : KSSLCertificate() {}
	void protected_setCert(X509* c) {
		KSSLCertificate::setCert(c);
		return;
	}
	void protected_setChain(void* c) {
		KSSLCertificate::setChain(c);
		return;
	}
	X509 * protected_getCert() {
		return (X509 *) KSSLCertificate::getCert();
	}
	KSSLValidation  protected_processError(int ec) {
		return (KSSLValidation ) KSSLCertificate::processError(ec);
	}
};

void kde_del_KSSLCertificate( kde_KSSLCertificate* p ){
	delete (KSSLCertificateBridge*) p;
}
qt_QString * kde_KSSLCertificate_toString( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->toString());
}
qt_QString * kde_KSSLCertificate_getSubject( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getSubject());
}
qt_QString * kde_KSSLCertificate_getIssuer( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getIssuer());
}
qt_QString * kde_KSSLCertificate_getNotBefore( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getNotBefore());
}
qt_QString * kde_KSSLCertificate_getNotAfter( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getNotAfter());
}
qt_QDateTime * kde_KSSLCertificate_getQDTNotBefore( kde_KSSLCertificate* instPointer){
	QDateTime _dt= ((KSSLCertificateBridge*)instPointer)->getQDTNotBefore();
	return (qt_QDateTime *)new QDateTime (_dt.date(),_dt.time());
}
qt_QDateTime * kde_KSSLCertificate_getQDTNotAfter( kde_KSSLCertificate* instPointer){
	QDateTime _dt= ((KSSLCertificateBridge*)instPointer)->getQDTNotAfter();
	return (qt_QDateTime *)new QDateTime (_dt.date(),_dt.time());
}
qt_QByteArray* kde_KSSLCertificate_toDer( kde_KSSLCertificate* instPointer){
	return (qt_QByteArray*)new QByteArray(((KSSLCertificateBridge*)instPointer)->toDer());
}
qt_QByteArray* kde_KSSLCertificate_toPem( kde_KSSLCertificate* instPointer){
	return (qt_QByteArray*)new QByteArray(((KSSLCertificateBridge*)instPointer)->toPem());
}
qt_QByteArray* kde_KSSLCertificate_toNetscape( kde_KSSLCertificate* instPointer){
	return (qt_QByteArray*)new QByteArray(((KSSLCertificateBridge*)instPointer)->toNetscape());
}
qt_QString * kde_KSSLCertificate_toText( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->toText());
}
qt_QString * kde_KSSLCertificate_getSerialNumber( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getSerialNumber());
}
qt_QString * kde_KSSLCertificate_getKeyType( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getKeyType());
}
qt_QString * kde_KSSLCertificate_getPublicKeyText( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getPublicKeyText());
}
qt_QString * kde_KSSLCertificate_getMD5DigestText( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getMD5DigestText());
}
qt_QString * kde_KSSLCertificate_getSignatureText( kde_KSSLCertificate* instPointer){
	return (qt_QString *)new QString(((KSSLCertificateBridge*)instPointer)->getSignatureText());
}
int kde_KSSLCertificate_isValid( kde_KSSLCertificate* instPointer){
	return (int) ((KSSLCertificateBridge*)instPointer)->isValid();
}
int kde_KSSLCertificate_validate( kde_KSSLCertificate* instPointer){
	return (int) ((KSSLCertificateBridge*)instPointer)->validate();
}
int kde_KSSLCertificate_revalidate( kde_KSSLCertificate* instPointer){
	return (int) ((KSSLCertificateBridge*)instPointer)->revalidate();
}
kde_KSSLCertChain* kde_KSSLCertificate_chain( kde_KSSLCertificate* instPointer){
	return (kde_KSSLCertChain*) ( KSSLCertChain *)&((KSSLCertificateBridge*)instPointer)->chain();
}
kde_KSSLCertificate* kde_KSSLCertificate_replicate( kde_KSSLCertificate* instPointer){
	return (kde_KSSLCertificate*) ((KSSLCertificateBridge*)instPointer)->replicate();
}
kde_KSSLCertificate * kde_new_KSSLCertificate(kde_KSSLCertificate* x){
	return (kde_KSSLCertificate *) new KSSLCertificateBridge((KSSLCertificate&)* (KSSLCertificate*)x);
}
int kde_KSSLCertificate_setCert( kde_KSSLCertificate* instPointer,qt_QString * cert){
	return (int) ((KSSLCertificateBridge*)instPointer)->setCert((QString&)* (QString*)cert);
}
kde_KSSLX509V3* kde_KSSLCertificate_x509V3Extensions( kde_KSSLCertificate* instPointer){
	return (kde_KSSLX509V3*) ( KSSLX509V3 *)&((KSSLCertificateBridge*)instPointer)->x509V3Extensions();
}
int kde_KSSLCertificate_isSigner( kde_KSSLCertificate* instPointer){
	return (int) ((KSSLCertificateBridge*)instPointer)->isSigner();
}
kde_KSSLCertificate* kde_KSSLCertificate_fromString( qt_QCString* cert){
	return (kde_KSSLCertificate*) KSSLCertificateBridge::fromString((QCString)* (QCString*)cert);
}
//kde_KSSLCertificate* kde_KSSLCertificate_fromX509( X509* x5){
//	return (kde_KSSLCertificate*) KSSLCertificateBridge::fromX509((X509*)x5);
//}
qt_QString * kde_KSSLCertificate_verifyText( int x){
	return (qt_QString *)new QString(KSSLCertificateBridge::verifyText((KSSLCertificate::KSSLValidation)x));
}
kde_KSSLCertificate * kde_new_KSSLCertificate1(){
	return (kde_KSSLCertificate *) new KSSLCertificateBridge();
}
void kde_KSSLCertificate_setChain( kde_KSSLCertificate* instPointer,void* c){
	((KSSLCertificateBridge*)instPointer)->protected_setChain((void*)c);
	return;
}
X509* kde_KSSLCertificate_getCert( kde_KSSLCertificate* instPointer){
	return (X509*) ((KSSLCertificateBridge*)instPointer)->protected_getCert();
}
int kde_KSSLCertificate_processError( kde_KSSLCertificate* instPointer,int ec){
	return (int) ((KSSLCertificateBridge*)instPointer)->protected_processError((int)ec);
}
