kio Library API Documentation

ksslpkcs7.h

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., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 // As of yet, this class is being defined.  if you use it, let it be known
00022 // that BC will break on you until this message is removed.
00023 
00024 #ifndef _KSSLPKCS7_H
00025 #define _KSSLPKCS7_H
00026 
00027 #include "ksslconfig.h"
00028 
00029 #ifdef KSSL_HAVE_SSL
00030 #define crypt _openssl_crypt
00031 #include <openssl/pkcs7.h>
00032 #undef crypt
00033 #else
00034 class PKCS7;
00035 class X509;
00036 #endif
00037 
00038 //#include <kopenssl.h>
00039 #include <ksslcertificate.h>
00040 #include <ksslcertchain.h>
00041 
00042 #ifndef STACK_OF
00043 #define STACK_OF(x) void
00044 #endif
00045 
00046 class KSSL;
00047 class KSSLPKCS7Private;
00048 class KOpenSSLProxy;
00049 
00050 
00051 class KSSLPKCS7 {
00052 friend class KSSL;
00053 
00054 public:
00055   virtual ~KSSLPKCS7();
00056 
00057   /*
00058    *   The name of this certificate.  This can be used to refer to the
00059    *   certificate instead of passing the object itself.
00060    */
00061   QString name();
00062 
00063   /*
00064    *   Create a KSSLPKCS7 object from a Base64 in a QString.  Returns NULL
00065    *   on failure.
00066    */
00067   static KSSLPKCS7* fromString(QString base64);
00068 
00069   /*
00070    *   Create a KSSLPKCS7 object by reading a PKCS#7 file.  Returns NULL
00071    *   on failure.
00072    */
00073   static KSSLPKCS7* loadCertFile(QString filename);
00074 
00075   /*
00076    *   Convert to a Base64 string.
00077    */
00078   QString toString();
00079 
00080   /*
00081    *   Raw set the PKCS7 object.
00082    */
00083   void setCert(PKCS7 *c);
00084 
00085   /*
00086    *   Get the bottom level X.509 certificate
00087    */
00088   KSSLCertificate *getCertificate();
00089 
00090 
00091   /*
00092    *   Get the certificate chain
00093    */
00094   KSSLCertChain *getChain();
00095 
00096 
00097   /*
00098    *   Write the PKCS#7 to a file in raw mode
00099    */
00100   bool toFile(QString filename);
00101 
00102 
00103   /*
00104    *   Check the chain to make sure it's valid.
00105    */
00106   KSSLCertificate::KSSLValidation validate();
00107   KSSLCertificate::KSSLValidation validate(KSSLCertificate::KSSLPurpose p);
00108 
00109 
00110   /*
00111    *   Check the chain to make sure it's valid.
00112    *   Ignore any cached validation result.
00113    */
00114   KSSLCertificate::KSSLValidation revalidate();
00115   KSSLCertificate::KSSLValidation revalidate(KSSLCertificate::KSSLPurpose p);
00116 
00117 
00118   /*
00119    *   Return true if the chain is valid.
00120    */
00121   bool isValid();
00122 
00123 
00124 
00125 protected:
00126   KSSLPKCS7();
00127 
00128 private:
00129   KSSLPKCS7Private *d;
00130   PKCS7 *_pkcs;
00131   KOpenSSLProxy *kossl;
00132   KSSLCertificate *_cert;
00133   KSSLCertChain *_chain;
00134 };
00135 
00136 
00137 #endif
00138 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:32 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001