00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef _KSSLPKCS12_H
00022
#define _KSSLPKCS12_H
00023
00024
#ifdef Q_WS_WIN
00025
#include "ksslconfig_win.h"
00026
#else
00027
#include "ksslconfig.h"
00028
#endif
00029
00030
#ifdef KSSL_HAVE_SSL
00031
#define crypt _openssl_crypt
00032
#include <openssl/pkcs12.h>
00033
#undef crypt
00034
#else
00035
class PKCS12;
00036
class EVP_PKEY;
00037
class X509;
00038
#endif
00039
00040
#include <ksslcertificate.h>
00041
#include <ksslcertchain.h>
00042
00043
#ifndef STACK_OF
00044
#define STACK_OF(x) void
00045
#endif
00046
00047
class KSSL;
00048
class KSSLPKCS12Private;
00049
class KOpenSSLProxy;
00050
00061 class KIO_EXPORT KSSLPKCS12 {
00062
friend class KSSL;
00063
00064
public:
00068
virtual ~KSSLPKCS12();
00069
00075
QString name();
00076
00083
static KSSLPKCS12* fromString(
QString base64,
QString password =
"");
00084
00091
static KSSLPKCS12* loadCertFile(
QString filename,
QString password =
"");
00092
00097
QString toString();
00098
00104
void setCert(PKCS12 *c);
00105
00112
bool changePassword(
QString pold,
QString pnew);
00113
00119 EVP_PKEY *getPrivateKey();
00120
00125
KSSLCertificate *getCertificate();
00126
00132
bool toFile(
QString filename);
00133
00139 KSSLCertificate::KSSLValidation validate();
00140
00147 KSSLCertificate::KSSLValidation validate(KSSLCertificate::KSSLPurpose p);
00148
00155 KSSLCertificate::KSSLValidation revalidate();
00156
00164 KSSLCertificate::KSSLValidation revalidate(KSSLCertificate::KSSLPurpose p);
00165
00170
bool isValid();
00171
00177
bool isValid(KSSLCertificate::KSSLPurpose p);
00178
00179
protected:
00180 KSSLPKCS12();
00181
bool parse(
QString pass);
00182
00183
private:
00184 KSSLPKCS12Private *d;
00185 PKCS12 *_pkcs;
00186
KOpenSSLProxy *kossl;
00187 EVP_PKEY *_pkey;
00188
KSSLCertificate *_cert;
00189 STACK_OF(X509) *_caStack;
00190 };
00191
00192
00193
#endif
00194