kio
ksslpkcs12.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2001 George Staikos <staikos@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 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