Commit d1753930 authored by Simon Josefsson's avatar Simon Josefsson

Imported Upstream version 3.1.15

parent 4b7dc0f4
2014-09-11 Klas Lindfors <klas@yubico.com>
* NEWS: NEWS for 3.1.15
2014-09-11 Klas Lindfors <klas@yubico.com>
* resources/resources.qrc, src/ui/mainwindow.cpp: new picture for
version 3.3+ with u2f logo
2014-09-11 Klas Lindfors <klas@yubico.com>
* YKPersonalization.pro: make sure the qtgui is writable
2014-09-11 Klas Lindfors <klas@yubico.com>
* YKPersonalization.pro, installer/win-nsis/ykpers.nsi: switch the
windows build to qt5
2014-09-09 Klas Lindfors <klas@yubico.com>
* src/ui/aboutpage.ui: move the support link to it's own line
2014-09-09 Klas Lindfors <klas@yubico.com>
* src/common.h, src/ui/aboutpage.cpp: fixup support link since it's
no longer mail
2014-09-04 mistertoh <mralvintoh@gmail.com>
* src/ui/aboutpage.ui: Update Link for Help and Discussion
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/yubikeylogger.cpp: fixup xml syntax
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/yubikeylogger.cpp: add CryptoModuleInfo with configSlot
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/yubikeylogger.cpp, src/yubikeylogger.h: add tokenLength
formatter to get responseFormat correct
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/yubikeylogger.cpp: user serial:slot for Key@Id
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/yubikeylogger.cpp, src/yubikeylogger.h: write start and end of
PSKC info
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/ui/mainwindow.cpp, src/ui/mainwindow.h, src/yubikeylogger.h:
register aboutToQuit() handler and call closeLogFile() there
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/yubikeylogger.cpp, src/yubikeylogger.h: close the logFile when
things change
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/yubikeylogger.cpp, src/yubikeylogger.h: implement secret key
in base64 for logging specifically for the pskc format
2014-08-28 Klas Lindfors <klas@yubico.com>
* src/ui/settingpage.ui, src/yubikeylogger.cpp, src/yubikeylogger.h:
add a first stab at an experimental PSKC output format this is clearly a naive least-effort implementation.. relates to #4
2014-07-15 Alessio Di Mauro <dimauro.alessio@gmail.com>
* src/ui/staticpage.cpp, src/ui/staticpage.ui: Added graying out of
text boxes and buttons when no layout is selected.
2014-07-07 Alessio Di Mauro <dimauro.alessio@gmail.com>
* src/ui/staticpage.cpp, src/ui/staticpage.h, src/ui/staticpage.ui:
Added dropdown menu for keyboard layout selection.
2014-04-23 Klas Lindfors <klas@yubico.com>
* src/yubikeyconfig.cpp: make sure to initialize all variables in
constructor specifically m_hmacLT64
2014-04-23 Klas Lindfors <klas@yubico.com>
* src/yubikeyutil.cpp: reduce scope of val
2014-04-23 Klas Lindfors <klas@yubico.com>
* src/ui/diagnostics.cpp: put the "unknown os" in #else
2014-04-23 Klas Lindfors <klas@yubico.com>
* src/yubikeylogger.cpp: fixup logging so all modes are logged use a switch-case instead of if to get warnings if we miss a case.
resolves #36
2014-04-22 Klas Lindfors <klas@yubico.com>
* : Merge pull request #35 from dudebout/patch-1 Adds a missind dependency in the README
2014-04-16 Klas Lindfors <klas@yubico.com>
* src/common.h: add head to html template
2014-02-27 David Wittman <david@wittman.com>
* src/ui/oathpage.ui, src/ui/otppage.ui, src/ui/staticpage.ui: Typo
fix in UI: s/Quicky/Quickly/
2014-01-28 Klas Lindfors <klas@yubico.com>
* src/yubikeyutil.cpp: change around qDebug() usage to get rid of
warnings
2014-01-10 Klas Lindfors <klas@yubico.com>
* NEWS, YKPersonalization.pro: bump versions
2014-01-10 Klas Lindfors <klas@yubico.com>
* NEWS: news for 3.1.14
......
yubikey-personalization-gui NEWS -- History of user-visible changes. -*- outline -*-
* Version 3.1.15 (released 2014-09-11)
** Add logging output format PSKC.
** Force selection of keyboard layout before programing scancode mode.
** Text changes.
** New picture for YubiKey 3.3.
* Version 3.1.14 (released 2014-01-10)
** Fix layout of the confirmbox window.
......
......@@ -59,7 +59,7 @@ For building on linux pkg-config is used to find these dependencies.
-----------
$ sudo apt-get install libusb-1.0-0-dev qt4-qmake libykpers-1-dev \
libyubikey-dev
libyubikey-dev libqt4-dev
-----------
Command-line build
......
......@@ -3,7 +3,7 @@
#
VERSION_MAJOR = 3
VERSION_MINOR = 1
VERSION_BUILD = 14
VERSION_BUILD = 15
VERSION = "$${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_BUILD}"
APP_NAME = $$quote(YubiKey Personalization Tool)
......@@ -191,22 +191,32 @@ win32 {
LIBS += $$quote(-L./libs/win64/bin) -llibyubikey-0 -llibykpers-1-1
}
LIBS += $$quote(-L$$_QT_BINDIR) $$quote(-L$$_QT_LIBDIR)
CONFIG(debug, debug|release) {
LIB_FILES += \
$$_QT_BINDIR$${DIR_SEPARATOR}QtCored4.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}QtGuid4.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}QtTestd4.dll \
$$_QT_PLUGINDIR$${DIR_SEPARATOR}imageformats$${DIR_SEPARATOR}qmngd4.dll
$$_QT_BINDIR$${DIR_SEPARATOR}Qt5Cored.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}Qt5Guid.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}Qt5Widgetsd.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}Qt5Testd.dll \
$$_QT_PLUGINDIR$${DIR_SEPARATOR}platforms$${DIR_SEPARATOR}qwindowsd.dll \
$$_QT_PLUGINDIR$${DIR_SEPARATOR}imageformats$${DIR_SEPARATOR}qmngd.dll
} else {
LIB_FILES += \
$$_QT_BINDIR$${DIR_SEPARATOR}QtCore4.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}QtGui4.dll \
$$_QT_PLUGINDIR$${DIR_SEPARATOR}imageformats$${DIR_SEPARATOR}qmng4.dll
$$_QT_BINDIR$${DIR_SEPARATOR}Qt5Core.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}Qt5Gui.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}Qt5Widgets.dll \
$$_QT_PLUGINDIR$${DIR_SEPARATOR}platforms$${DIR_SEPARATOR}qwindows.dll \
$$_QT_PLUGINDIR$${DIR_SEPARATOR}imageformats$${DIR_SEPARATOR}qmng.dll
}
LIB_FILES += \
$$_QT_BINDIR$${DIR_SEPARATOR}libgcc_s_dw2-1.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}mingwm10.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}libwinpthread-1.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}libstdc++-6.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}icuin52.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}icuuc52.dll \
$$_QT_BINDIR$${DIR_SEPARATOR}icudt52.dll \
libs$${DIR_SEPARATOR}win32$${DIR_SEPARATOR}bin$${DIR_SEPARATOR}libjson-c-2.dll \
libs$${DIR_SEPARATOR}win32$${DIR_SEPARATOR}bin$${DIR_SEPARATOR}libyubikey-0.dll \
libs$${DIR_SEPARATOR}win32$${DIR_SEPARATOR}bin$${DIR_SEPARATOR}libykpers-1-1.dll
......@@ -357,6 +367,7 @@ macx:!force_pkgconfig {
}
QMAKE_POST_LINK += $$quote( && $$_INSTALL_NAME_TOOL -change $$_QTCORE $$_BASE/$$_QTCORE $$_BASEDIR/MacOS/$$TARGET_MAC && \
$$_INSTALL_NAME_TOOL -change $$_QTGUI $$_BASE/$$_QTGUI $$_BASEDIR/MacOS/$$TARGET_MAC && \
chmod +w $$_FRAMEWORKDIR/$$_QTGUI && \
$$_INSTALL_NAME_TOOL -change $$_QTCORE $$_BASE/$$_QTCORE $$_FRAMEWORKDIR/$$_QTGUI && \
$$_INSTALL_NAME_TOOL -change $$_QTCORE $$_BASE/$$_QTCORE $$_PLUGINDIR/imageformats/libqmng.dylib && \
$$_INSTALL_NAME_TOOL -change $$_QTGUI $$_BASE/$$_QTGUI $$_PLUGINDIR/imageformats/libqmng.dylib)
......
......@@ -63,14 +63,21 @@ Section "YubiKey Personalization Tool"
FILE ../../build/release/libjson-c-2.dll
FILE ../../build/release/libyubikey-0.dll
FILE ../../build/release/libykpers-1-1.dll
FILE ../../build/release/QtCore4.dll
FILE ../../build/release/QtGui4.dll
FILE ../../build/release/Qt5Core.dll
FILE ../../build/release/Qt5Gui.dll
FILE ../../build/release/Qt5Widgets.dll
FILE ../../build/release/libgcc_s_dw2-1.dll
FILE ../../build/release/mingwm10.dll
FILE ../../build/release/libwinpthread-1.dll
FILE ../../build/release/libstdc++-6.dll
FILE ../../build/release/icuin52.dll
FILE ../../build/release/icuuc52.dll
FILE ../../build/release/icudt52.dll
SetOutPath $INSTDIR\licenses
FILE /r ../../build/release/licenses/
SetOutPath $INSTDIR\imageformats
FILE ../../build/release/qmng4.dll
FILE ../../build/release/qmng.dll
SetOutPath $INSTDIR\platforms
FILE ../../build/release/qwindows.dll
SectionEnd
Var MYTMP
......@@ -118,17 +125,22 @@ Section "Uninstall"
DELETE "$INSTDIR\libjson-c-2.dll"
DELETE "$INSTDIR\libyubikey-0.dll"
DELETE "$INSTDIR\libykpers-1-1.dll"
DELETE "$INSTDIR\QtCore4.dll"
DELETE "$INSTDIR\QtGui4.dll"
DELETE "$INSTDIR\Qt5Core.dll"
DELETE "$INSTDIR\Qt5Gui.dll"
DELETE "$INSTDIR\Qt5Widgets.dll"
DELETE "$INSTDIR\libgcc_s_dw2-1.dll"
DELETE "$INSTDIR\libgcc_s_sjlj-1.dll"
DELETE "$INSTDIR\libwinpthread-1.dll"
DELETE "$INSTDIR\libstdc++-6.dll"
DELETE "$INSTDIR\mingwm10.dll"
DELETE "$INSTDIR\icuin52.dll"
DELETE "$INSTDIR\icuuc52.dll"
DELETE "$INSTDIR\icudt52.dll"
DELETE "$INSTDIR\licenses\*"
DELETE "$INSTDIR\imageformats\qmng4.dll"
DELETE "$INSTDIR\imageformats\qmng.dll"
DELETE "$INSTDIR\platforms\qwindows.dll"
RMDir "$INSTDIR\licenses"
RMDir "$INSTDIR\imageformats"
RMDir "$INSTDIR\platforms"
; Remove uninstaller
Delete $INSTDIR\uninstall.exe
......
......@@ -16,5 +16,6 @@
<file>images/neo_transparent.png</file>
<file>images/yubikey_devel.png</file>
<file>images/neo_production.png</file>
<file>images/neo_production_33.png</file>
</qresource>
</RCC>
......@@ -57,8 +57,8 @@ enum AccMode {
#define WRITE_CONFIG 0
#define EXPORT_CONFIG 1
#define SUPPORT_EMAIL tr("mailto:support@yubico.com")
#define UPLOAD_URL tr("<!doctype html><html><title>upload</title></head><body><form action='https://upload.yubico.com/' method='post' id='upload'>serial:<input name='serial' value='%1'/><br/>prefix:<input name='prefix' value='%2'/><br/>uid:<input name='uid' value='%3'/><br/>aeskey:<input name='aeskey' value='%4'/><br/><input type='submit'/><br/></form><script type='text/javascript'>window.onload=function(){document.getElementById('upload').submit();}</script></body></html>")
#define SUPPORT_LINK tr("http://yubi.co/forum")
#define UPLOAD_URL tr("<!doctype html><html><head><title>upload</title></head><body><form action='https://upload.yubico.com/' method='post' id='upload'>serial:<input name='serial' value='%1'/><br/>prefix:<input name='prefix' value='%2'/><br/>uid:<input name='uid' value='%3'/><br/>aeskey:<input name='aeskey' value='%4'/><br/><input type='submit'/><br/></form><script type='text/javascript'>window.onload=function(){document.getElementById('upload').submit();}</script></body></html>")
#define ERR_NOERROR 0
#define ERR_OTHER 1
......
......@@ -151,5 +151,5 @@ void AboutPage::btn_pressed(int pageIndex) {
}
void AboutPage::on_supportBtn_clicked() {
QDesktopServices::openUrl(QUrl(SUPPORT_EMAIL));
QDesktopServices::openUrl(QUrl(SUPPORT_LINK));
}
......@@ -453,19 +453,19 @@ color: rgb(118, 116, 108);</string>
<rect>
<x>20</x>
<y>290</y>
<width>385</width>
<width>191</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>If you have any questions or suggestions, please send an email to</string>
<string>For help and discussion, head to</string>
</property>
</widget>
<widget class="QPushButton" name="supportBtn">
<property name="geometry">
<rect>
<x>410</x>
<y>289</y>
<x>20</x>
<y>310</y>
<width>131</width>
<height>20</height>
</rect>
......@@ -494,7 +494,7 @@ text-decoration: underline;
color: rgb(5, 67, 168);</string>
</property>
<property name="text">
<string>support@yubico.com</string>
<string>http://yubi.co/forum</string>
</property>
<property name="autoDefault">
<bool>false</bool>
......
......@@ -129,7 +129,8 @@ QString Diagnostics::osVersion() {
break;
}
return win;
#endif
#else
return "Unknown OS";
#endif
}
......@@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "yubikeyfinder.h"
#include "yubikeywriter.h"
#include "yubikeyutil.h"
#include "yubikeylogger.h"
#include "ui/otppage.h"
#include "ui/oathpage.h"
#include "ui/staticpage.h"
......@@ -63,6 +64,8 @@ MainWindow::MainWindow(QWidget *parent) :
//Connect other signals and slots
connect(ui->exitMenuBtn, SIGNAL(clicked()), qApp, SLOT(quit()));
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()));
connect(YubiKeyFinder::getInstance(), SIGNAL(keyFound(bool, bool*, int)),
this, SLOT(keyFound(bool, bool*, int)));
connect(YubiKeyWriter::getInstance(), SIGNAL(errorOccurred(QString)),
......@@ -391,8 +394,10 @@ void MainWindow::keyFound(bool found, bool* featuresMatrix, int error) {
movie->setFileName(":/res/images/v2-2-animated.mng");
} else if(version < YK_VERSION(3,0,0)){
movie->setFileName(":/res/images/v2-3-animated.mng");
} else { // only case left should be version over 3, that is neo
} else if(version < YK_VERSION(3,3,0)){
pixmap.load(":/res/images/neo_production.png");
} else { // only case left should be version over 3.3, that is neo + u2f
pixmap.load(":/res/images/neo_production_33.png");
}
if(pixmap.isNull()) {
ui->deviceImage->setMovie(movie);
......@@ -635,3 +640,7 @@ void MainWindow::triggerHelp(int index) {
m_help->setHelpIndex((HelpBox::Help)index);
m_help->show();
}
void MainWindow::aboutToQuit() {
YubiKeyLogger::closeLogFile();
}
......@@ -108,6 +108,8 @@ private slots:
void toggleAnimation(bool checked);
void triggerDiagnostics();
void triggerHelp(int index);
void aboutToQuit();
};
#endif // MAINWINDOW_H
......@@ -140,7 +140,7 @@ font-weight: bold;</string>
</rect>
</property>
<property name="text">
<string>Quicky program a YubiKey in OATH-HOTP mode</string>
<string>Quickly program a YubiKey in OATH-HOTP mode</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
......
......@@ -140,7 +140,7 @@ font-weight: bold;</string>
</rect>
</property>
<property name="text">
<string>Quicky program a YubiKey for use with Yubico Validation Server</string>
<string>Quickly program a YubiKey for use with Yubico Validation Server</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
......
......@@ -309,6 +309,11 @@ color: rgb(140, 192, 65);</string>
<string>Flexible format</string>
</property>
</item>
<item>
<property name="text">
<string>PSKC format</string>
</property>
</item>
</widget>
<widget class="QLineEdit" name="logFormatEdit">
<property name="enabled">
......
......@@ -292,9 +292,12 @@ void StaticPage::resetQuickPage() {
ui->quickStaticLenTxt->setText("0");
ui->quickStaticTxt->clear();
ui->quickStaticTxt->setEnabled(false);
ui->quickScanCodesTxt->clear();
ui->quickInsertTabBtn->setEnabled(true);
ui->quickClearBtn->setEnabled(true);
ui->quickScanCodesTxt->setEnabled(false);
ui->quickInsertTabBtn->setEnabled(false);
ui->quickClearBtn->setEnabled(false);
ui->quickKeymapCmb->setCurrentIndex(0);
ui->quickStopBtn->setEnabled(false);
ui->quickResetBtn->setEnabled(false);
......@@ -1108,3 +1111,24 @@ void StaticPage::setCurrentSlot(int slot) {
ui->quickConfigSlot2Radio->setChecked(slot == 2);
}
}
void StaticPage::on_quickKeymapCmb_currentIndexChanged(int index)
{
// Reset these, independent of the chosen layout
ui->quickStaticLenTxt->setText("0");
ui->quickStaticTxt->clear();
ui->quickScanCodesTxt->clear();
if (index == 0) {
ui->quickStaticTxt->setEnabled(false);
ui->quickScanCodesTxt->setEnabled(false);
ui->quickInsertTabBtn->setEnabled(false);
ui->quickClearBtn->setEnabled(false);
}
else {
ui->quickStaticTxt->setEnabled(true);
ui->quickScanCodesTxt->setEnabled(true);
ui->quickInsertTabBtn->setEnabled(true);
ui->quickClearBtn->setEnabled(true);
}
}
......@@ -140,6 +140,8 @@ private slots:
void on_quickScanCodesTxt_textEdited(const QString &text);
void on_quickKeymapCmb_currentIndexChanged(int index);
signals:
void showStatusMessage(const QString &text, int status = 0);
void showHelp(int helpIndex);
......
......@@ -30,7 +30,7 @@
color: rgb(0, 0, 0);</string>
</property>
<property name="currentIndex">
<number>2</number>
<number>1</number>
</property>
<widget class="QWidget" name="basePage">
<widget class="QLabel" name="baseHeadingLbl">
......@@ -140,7 +140,7 @@ font-weight: bold;</string>
</rect>
</property>
<property name="text">
<string>Quicky program a YubiKey to emit your desired static password</string>
<string>Quickly program a YubiKey to emit your desired static password</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
......@@ -362,9 +362,6 @@ border-radius: 10px;
</property>
</widget>
<widget class="QLineEdit" name="quickStaticTxt">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>150</x>
......@@ -555,9 +552,6 @@ font-weight: bold;</string>
</property>
</widget>
<widget class="QPushButton" name="quickClearBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>270</x>
......@@ -630,6 +624,63 @@ font-weight: bold;</string>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<family>Verdana</family>
<pointsize>-1</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-weight: normal;</string>
</property>
</widget>
<widget class="QLabel" name="quickKeymapLbl">
<property name="geometry">
<rect>
<x>490</x>
<y>105</y>
<width>51</width>
<height>20</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font-weight:normal;</string>
</property>
<property name="text">
<string>Keyboard</string>
</property>
</widget>
<widget class="QComboBox" name="quickKeymapCmb">
<property name="geometry">
<rect>
<x>549</x>
<y>101</y>
<width>141</width>
<height>22</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">font-weight: normal;</string>
</property>
<item>
<property name="text">
<string>Choose a layout ...</string>
</property>
</item>
<item>
<property name="text">
<string>US Keyboard</string>
</property>
</item>
</widget>
</widget>
<widget class="QGroupBox" name="quickActionsBox">
......@@ -1130,7 +1181,7 @@ border-radius: 10px;
<string notr="true">font-weight: normal;</string>
</property>
<property name="inputMask">
<string>hh hh hh hh hh hh hh hh hh hh hh hh hh hh hh hh; </string>
<string>hh hh hh hh hh hh hh hh hh hh hh hh hh hh hh hh</string>
</property>
<property name="text">
<string>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</string>
......@@ -1221,7 +1272,7 @@ font-weight: bold;</string>
<string notr="true">font-weight: normal;</string>
</property>
<property name="inputMask">
<string>hh hh hh hh hh hh; </string>
<string>hh hh hh hh hh hh</string>
</property>
<property name="text">
<string>00 00 00 00 00 00</string>
......
......@@ -71,6 +71,7 @@ YubiKeyConfig::YubiKeyConfig() {
m_chalYubico = false;
m_chalHmac = false;
m_chalBtnTrig = false;
m_hmacLT64 = false;
m_serialBtnVisible = settings.value(SG_SR_BTN_VISIBLE).toBool();
m_serialUsbVisible = settings.value(SG_SR_USB_VISIBLE).toBool();
m_serialApiVisible = settings.value(SG_SR_API_VISIBLE).toBool();
......
......@@ -56,6 +56,7 @@ struct logging_st YubiKeyLogger::logging_map[] = {
{ "pubIdTxt", "pubIdTxt", STRING, NULL },
{ "pvtIdTxt", "pvtIdTxt", STRING, NULL },
{ "secretKeyTxt", "secretKeyTxt", STRING, NULL },
{ "secretKeyB64", NULL, STRING, YubiKeyLogger::resolve_secretKeyB64 },
{ "currentAccessCodeTxt", "currentAccessCodeTxt", STRING, NULL },
{ "newAccessCodeTxt", "newAccessCodeTxt", STRING, NULL },
{ "hotpDigits", NULL, STRING, YubiKeyLogger::resolve_hotpDigits },
......@@ -69,6 +70,7 @@ struct logging_st YubiKeyLogger::logging_map[] = {
{ "oathFixedModhex1", "oathFixedModhex1", BOOL, NULL },
{ "oathFixedModhex2", "oathFixedModhex2", BOOL, NULL },
{ "oathFixedModhex", "oathFixedModhex", BOOL, NULL },
{ "tokenLength", NULL, STRING, YubiKeyLogger::resolve_tokenLength },
{ "serial", "serial", STRING, NULL },
{ "endl", NULL, STRING, YubiKeyLogger::resolve_symbol },
{ "tab", NULL, STRING, YubiKeyLogger::resolve_symbol },
......@@ -95,6 +97,18 @@ QFile *YubiKeyLogger::getLogFile() {
return m_logFile;
}
void YubiKeyLogger::closeLogFile() {
if(m_logFile != NULL) {
if(m_format == Format_PSKC) {
endPSKC();
}
m_logFile->close();
delete(m_logFile);
m_logFile = NULL;
m_started = true;
}
}
QString YubiKeyLogger::formatLog(YubiKeyConfig *ykConfig, QString format) {
for(unsigned long i = 0; i < (sizeof(logging_map) / sizeof(logging_st)); i++) {
QString token = QString("{") + logging_map[i].name + QString("}");
......@@ -138,13 +152,6 @@ void YubiKeyLogger::logConfig(YubiKeyConfig *ykConfig) {
return;
}
QFile *file = getLogFile();
if(file == NULL) {
return;
}
QTextStream out(file);
QString format = "";
if(m_format == Format_Traditional) {
if(m_started) {
......@@ -165,6 +172,30 @@ void YubiKeyLogger::logConfig(YubiKeyConfig *ykConfig) {
format += ",,";
}
format += "{secretKeyTxt},{newAccessCodeTxt},{timestampFixed},";
} else if(m_format == Format_PSKC) {
if(m_started) {
format += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>{endl}<KeyContainer Version=\"1.0\" xmlns=\"urn:ietf:params:xml:ns:keyprov:pskc\">{endl}";
m_started = false;
}
format += "<KeyPackage><DeviceInfo><Manufacturer>Yubico</Manufacturer><SerialNo>{serial}</SerialNo></DeviceInfo>";
format += "<CryptoModuleInfo><Id>{configSlot}</Id></CryptoModuleInfo><Key Id=\"{serial}:{configSlot}\"";
if(ykConfig->programmingMode() == YubiKeyConfig::Mode_YubicoOtp) {
format += " Algorithm=\"http://www.yubico.com/#yubikey-aes\"><AlgorithmParameters><ResponseFormat Length=\"{tokenLength}\" Encoding=\"ALPHANUMERIC\"/></AlgorithmParameters>";
} else if(ykConfig->programmingMode() == YubiKeyConfig::Mode_OathHotp) {
format += " Algorithm=\"urn:ietf:params:xml:ns:keyprov:pskc:hotp\"><AlgorithmParameters><ResponseFormat Length=\"{tokenLength}\" Encoding=\"DECIMAL\"/></AlgorithmParameters>";
} else {
qDebug() << "PSKC is primarily for Oath-HOTP and Yubico-OTP";
format += ">";
}
format += "<Data><Secret><PlainValue>{secretKeyB64}</PlainValue></Secret>";
if(ykConfig->programmingMode() == YubiKeyConfig::Mode_OathHotp) {
format += "<Counter><PlainValue>{oathMovingFactorSeed}</PlainValue></Counter>";
}
format += "</Data>";
if(ykConfig->programmingMode() == YubiKeyConfig::Mode_YubicoOtp) {
format += "<UserId>CN={pubIdTxt}, UID={pvtIdTxt}</UserId>";
}
format += "</Key></KeyPackage>";
} else if(m_format == Format_Flexible) {
format = m_flexibleFormat;
} else {
......@@ -172,8 +203,7 @@ void YubiKeyLogger::logConfig(YubiKeyConfig *ykConfig) {
return;
}
format = formatLog(ykConfig, format);
out << format << endl;
file->flush();
logString(format);
}
void YubiKeyLogger::enableLogging() {
......@@ -189,6 +219,7 @@ bool YubiKeyLogger::isLogging() {
}
void YubiKeyLogger::setLogFilename(const QString &filename) {
closeLogFile();
m_filename = filename;
}
......@@ -201,6 +232,7 @@ QString YubiKeyLogger::defaultLogFilename() {
}
void YubiKeyLogger::setLogFormat(Format format) {
closeLogFile();
m_format = format;
}
......@@ -217,29 +249,31 @@ QString YubiKeyLogger::resolve_hotpDigits(YubiKeyConfig *ykConfig, QString name
}
QString YubiKeyLogger::resolve_eventType(YubiKeyConfig *ykConfig, QString name __attribute__((unused))) {
int mode = ykConfig->programmingMode();
if(mode == YubiKeyConfig::Mode_YubicoOtp) {
return(tr("Yubico OTP"));
} else if(mode == YubiKeyConfig::Mode_Static) {
QString eventType = tr("Static Password");
if(ykConfig->shortTicket()) {
if(ykConfig->staticTicket()) {
eventType.append(tr(": Short"));
} else {
eventType.append(tr(": Scan Code"));
switch(ykConfig->programmingMode()) {
case YubiKeyConfig::Mode_YubicoOtp:
return(tr("Yubico OTP"));
case YubiKeyConfig::Mode_Static:
{
QString eventType = tr("Static Password");
if(ykConfig->shortTicket()) {
if(ykConfig->staticTicket()) {
eventType.append(tr(": Short"));
} else {
eventType.append(tr(": Scan Code"));
}
}
return eventType;
}
}
return eventType;
} else if(mode == YubiKeyConfig::Mode_OathHotp) {
return(tr("OATH-HOTP"));
} else if(mode == YubiKeyConfig::Mode_ChalRespHmac) {
return(tr("Challenge-Response: Yubico OTP"));
} else if(mode == YubiKeyConfig::Mode_ChalRespHmac) {
return(tr("Challenge-Response: HMAC-SHA1"));
} else if(mode == YubiKeyConfig::Mode_Update) {