ksslpkcs7.h
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2001-2003 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 _KSSLPKCS7_H 00022 #define _KSSLPKCS7_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/pkcs7.h> 00033 #undef crypt 00034 #else 00035 class PKCS7; 00036 class X509; 00037 #endif 00038 00039 //#include <kopenssl.h> 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 KSSLPKCS7Private; 00049 class KOpenSSLProxy; 00050 00060 class KIO_EXPORT KSSLPKCS7 { 00061 friend class KSSL; 00062 00063 public: 00067 virtual ~KSSLPKCS7(); 00068 00074 QString name(); 00075 00081 static KSSLPKCS7* fromString(QString base64); 00082 00088 static KSSLPKCS7* loadCertFile(QString filename); 00089 00094 QString toString(); 00095 00101 void setCert(PKCS7 *c); 00102 00108 KSSLCertificate *getCertificate(); 00109 00115 KSSLCertChain *getChain(); 00116 00122 bool toFile(QString filename); 00123 00128 KSSLCertificate::KSSLValidation validate(); 00129 00136 KSSLCertificate::KSSLValidation revalidate(); 00137 00141 bool isValid(); 00142 00143 protected: 00144 KSSLPKCS7(); 00145 00146 private: 00147 KSSLPKCS7Private *d; 00148 PKCS7 *_pkcs; 00149 KOpenSSLProxy *kossl; 00150 KSSLCertificate *_cert; 00151 KSSLCertChain *_chain; 00152 }; 00153 00154 00155 #endif 00156