| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# ksslpkcs12.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 _KSSLPKCS12_H
    00025 #define _KSSLPKCS12_H
    00026
    00027 #include "ksslconfig.h"
    00028
    00029 #ifdef KSSL_HAVE_SSL
    00030 #define crypt _openssl_crypt
    00031 #include <openssl/pkcs12.h>
    00032 #undef crypt
    00033 #else
    00034 class PKCS12;
    00035 class EVP_PKEY;
    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 KSSLPKCS12Private;
    00049 class KOpenSSLProxy;
    00050
    00051
    00052 class KSSLPKCS12 {
    00053 friend class KSSL;
    00054
    00055 public:
    00056   virtual ~KSSLPKCS12();
    00057
    00058   /*
    00059    *   The name of this certificate.  This can be used to refer to the
    00060    *   certificate instead of passing the object itself.
    00061    */
    00062   QString name();
    00063
    00064   /*
    00065    *   Create a KSSLPKCS12 object from a Base64 in a QString.  Returns NULL
    00066    *   on failure.
    00067    */
    00068   static KSSLPKCS12* fromString(QString base64, QString password = "");
    00069
    00070   /*
    00071    *   Create a KSSLPKCS12 object by reading a PKCS#12 file.  Returns NULL
    00072    *   on failure.
    00073    */
    00074   static KSSLPKCS12* loadCertFile(QString filename, QString password = "");
    00075
    00076   /*
    00077    *   Convert to a Base64 string.
    00078    */
    00079   QString toString();
    00080
    00081   /*
    00082    *   Raw set the PKCS12 object.
    00083    */
    00084   void setCert(PKCS12 *c);
    00085
    00086   /*
    00087    *   Change the password of the PKCS#12 in memory.  Returns true on success.
    00088    */
    00089   bool changePassword(QString pold, QString pnew);
    00090
    00091
    00092   /*
    00093    *   Get the private key
    00094    */
    00095   EVP_PKEY *getPrivateKey();
    00096
    00097
    00098   /*
    00099    *   Get the X.509 certificate
    00100    */
    00101   KSSLCertificate *getCertificate();
    00102
    00103
    00104   /*
    00105    *   Write the PKCS#12 to a file in raw mode
    00106    */
    00107   bool toFile(QString filename);
    00108
    00109
    00110   /*
    00111    *   Check the X.509 and private key to make sure they're valid.
    00112    */
    00113   KSSLCertificate::KSSLValidation validate();
    00114   KSSLCertificate::KSSLValidation validate(KSSLCertificate::KSSLPurpose p);
    00115
    00116
    00117   /*
    00118    *   Check the X.509 and private key to make sure they're valid.
    00119    *   Ignore any cached validation result.
    00120    */
    00121   KSSLCertificate::KSSLValidation revalidate();
    00122   KSSLCertificate::KSSLValidation revalidate(KSSLCertificate::KSSLPurpose p);
    00123
    00124
    00125   /*
    00126    *   Return true if the X.509 and private key are valid.
    00127    */
    00128   bool isValid();
    00129   bool isValid(KSSLCertificate::KSSLPurpose p);
    00130
    00131
    00132
    00133 protected:
    00134   KSSLPKCS12();
    00135
    00136   /*
    00137    *   Parse the PKCS#12
    00138    */
    00139   bool parse(QString pass);
    00140
    00141 private:
    00142   KSSLPKCS12Private *d;
    00143   PKCS12 *_pkcs;
    00144   KOpenSSLProxy *kossl;
    00145   EVP_PKEY *_pkey;
    00146   KSSLCertificate *_cert;
    00147   STACK_OF(X509) *_caStack;
    00148 };
    00149
    00150
    00151 #endif
    00152

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:26 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001