File indexing completed on 2024-04-21 14:56:09

0001 /* This file is part of the KDE project
0002  *
0003  * Copyright (C) 2000-2003 George Staikos <staikos@kde.org>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 #ifndef _INCLUDE_KSSLUTILS_H
0021 #define _INCLUDE_KSSLUTILS_H
0022 
0023 #include <kdelibs4support_export.h>
0024 #include <ksslconfig.h>
0025 
0026 #if KSSL_HAVE_SSL
0027 #define crypt _openssl_crypt
0028 #include <openssl/x509.h>
0029 #undef crypt
0030 #endif
0031 class QString;
0032 class QDateTime;
0033 
0034 #if KSSL_HAVE_SSL
0035 // This functionality is missing in OpenSSL
0036 /**
0037  *  Convert an ASN1 UTCTIME value to a string.  Uses KLocale settings.
0038  *
0039  *  @param tm the OpenSSL ASN1_UTCTIME pointer
0040  *
0041  *  @return the date formatted in a QString
0042  *  @see ASN1_UTCTIME_QDateTime
0043  */
0044 QString ASN1_UTCTIME_QString(ASN1_UTCTIME *tm);
0045 
0046 /**
0047  *  Convert an ASN1 UTCTIME value to a QDateTime.  Uses KLocale settings.
0048  *
0049  *  @param tm the OpenSSL ASN1_UTCTIME pointer
0050  *  @param isGmt set to 1 if the date is set to GMT
0051  *
0052  *  @return the date formatted in a QDateTime
0053  */
0054 QDateTime ASN1_UTCTIME_QDateTime(ASN1_UTCTIME *tm, int *isGmt);
0055 
0056 /**
0057  *  Convert an ASN1 INTEGER value to a string.
0058  *
0059  *  @param aint the OpenSSL ASN1_INTEGER pointer
0060  *
0061  *  @return the number formatted in a QString
0062  */
0063 QString ASN1_INTEGER_QString(ASN1_INTEGER *aint);
0064 #endif
0065 
0066 #endif