ksslpemcallback.cc
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024 
00025 #include <kpassdlg.h>
00026 #include <klocale.h>
00027 #include "ksslpemcallback.h"
00028 
00029 int KSSLPemCallback(char *buf, int size, int rwflag, void *userdata) {
00030 #ifdef KSSL_HAVE_SSL
00031     QCString pass;
00032     Q_UNUSED(userdata);
00033     Q_UNUSED(rwflag);
00034 
00035     if (!buf) return -1;
00036     int rc = KPasswordDialog::getPassword(pass, i18n("Certificate password"));
00037     if (rc != KPasswordDialog::Accepted) return -1;
00038 
00039     if (pass.length() > (unsigned int)size-1)
00040         pass.truncate((unsigned int)size-1);
00041 
00042     qstrncpy(buf, pass.data(), size-1);
00043     for (unsigned int i = 0; i < pass.length(); i++)
00044         pass[i] = 0;
00045     
00046     for (unsigned int i = 0; i < pass.length(); i++)
00047         pass[i] = pass[i];
00048     buf[size-1] = 0;
00049     return (int)pass.length();
00050 #else
00051     Q_UNUSED(buf);
00052     Q_UNUSED(size);
00053     Q_UNUSED(rwflag);
00054     Q_UNUSED(userdata);
00055     return -1;
00056 #endif
00057 }
00058 
00059 
 
This file is part of the documentation for kio Library Version 3.2.0.