# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# ksslx509v3.cc

    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 #ifdef HAVE_CONFIG_H
    00022 #include <config.h>
    00023 #endif
    00024
    00025 #include "ksslx509v3.h"
    00026 #include <kopenssl.h>
    00027 #include <kdebug.h>
    00028
    00029
    00030 KSSLX509V3::KSSLX509V3() {
    00031     flags = 0;
    00032 }
    00033
    00034
    00035 KSSLX509V3::~KSSLX509V3() {
    00036 }
    00037
    00038
    00039 /* When reading this, please remember that
    00040  * !A || B    is logically equivalent to   A => B
    00041  */
    00042
    00043 bool KSSLX509V3::certTypeCA() {
    00044 #ifdef KSSL_HAVE_SSL
    00045     // First try CA without X509_PURPOSE_ANY CA, then just try SSLCA
    00046     return (flags & (65471L << 16)) ? true : certTypeSSLCA();
    00047 #endif
    00048     return false;
    00049 }
    00050
    00051
    00052 bool KSSLX509V3::certTypeSSLCA() {
    00053 #ifdef KSSL_HAVE_SSL
    00054     return (flags & ((1 << (16+X509_PURPOSE_NS_SSL_SERVER-1))|
    00055                          (1 << (16+X509_PURPOSE_SSL_SERVER-1))|
    00056                          (1 << (16+X509_PURPOSE_SSL_CLIENT-1)))) ? true :
    00057         (false || ((1 << (16+X509_PURPOSE_ANY-1)) &&
    00058                (certTypeSSLServer() ||
    00059                 certTypeSSLClient() ||
    00060                 certTypeNSSSLServer())));
    00061 #endif
    00062     return false;
    00063 }
    00064
    00065
    00066 bool KSSLX509V3::certTypeEmailCA() {
    00067 #ifdef KSSL_HAVE_SSL
    00068     return (flags & ((1 << (16+X509_PURPOSE_SMIME_ENCRYPT-1))|
    00069                          (1 << (16+X509_PURPOSE_SMIME_SIGN-1)))) ? true :
    00070         (false || ((1 << (16+X509_PURPOSE_ANY-1)) &&
    00071                certTypeSMIME()));
    00072 #endif
    00073     return false;
    00074 }
    00075
    00076
    00077 bool KSSLX509V3::certTypeCodeCA() {
    00078 #ifdef KSSL_HAVE_SSL
    00079     return (flags & (1 << (16+X509_PURPOSE_ANY-1))) ? true : false;
    00080 #endif
    00081     return false;
    00082 }
    00083
    00084
    00085 bool KSSLX509V3::certTypeSSLClient() {
    00086 #ifdef KSSL_HAVE_SSL
    00087     return (flags & (1 << (X509_PURPOSE_SSL_CLIENT-1))) ? true : false;
    00088 #endif
    00089     return false;
    00090 }
    00091
    00092
    00093 bool KSSLX509V3::certTypeSSLServer() {
    00094 #ifdef KSSL_HAVE_SSL
    00095     return (flags & (1 << (X509_PURPOSE_SSL_SERVER-1))) ? true : false;
    00096 #endif
    00097     return false;
    00098 }
    00099
    00100
    00101 bool KSSLX509V3::certTypeNSSSLServer() {
    00102 #ifdef KSSL_HAVE_SSL
    00103     return (flags & (1 << (X509_PURPOSE_NS_SSL_SERVER-1))) ? true : false;
    00104 #endif
    00105     return false;
    00106 }
    00107
    00108
    00109 bool KSSLX509V3::certTypeSMIME() {
    00110 #ifdef KSSL_HAVE_SSL
    00111     return certTypeSMIMEEncrypt()||certTypeSMIMESign();
    00112 #endif
    00113     return false;
    00114 }
    00115
    00116
    00117 bool KSSLX509V3::certTypeSMIMEEncrypt() {
    00118 #ifdef KSSL_HAVE_SSL
    00119     return (flags & (1 << (X509_PURPOSE_SMIME_ENCRYPT-1))) ? true : false;
    00120 #endif
    00121     return false;
    00122 }
    00123
    00124
    00125 bool KSSLX509V3::certTypeSMIMESign() {
    00126 #ifdef KSSL_HAVE_SSL
    00127     return (flags & (1 << (X509_PURPOSE_SMIME_SIGN-1))) ? true : false;
    00128 #endif
    00129     return false;
    00130 }
    00131
    00132
    00133 bool KSSLX509V3::certTypeCRLSign() {
    00134 #ifdef KSSL_HAVE_SSL
    00135     return (flags & (1 << (X509_PURPOSE_CRL_SIGN-1))) ? true : false;
    00136 #endif
    00137     return false;
    00138 }
    00139
    00140
    00141
    00142
    00143

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:04 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003