├── w32 ├── logo-128.bmp ├── logo-32.bmp ├── logo-48.bmp ├── logo-64.bmp ├── logo-96.bmp ├── resource.h ├── Makefile.am └── pinentry-w32.rc ├── qt ├── icons │ ├── pinentry.png │ ├── data-error.svg │ ├── password-generate.svg │ ├── password-generate_dark.svg │ ├── Makefile.am │ ├── hint.svg │ ├── hint_dark.svg │ ├── visibility.svg │ └── visibility_dark.svg ├── org.gnupg.pinentry-qt.desktop.in ├── pinentryrc.qrc ├── capslock_win.cpp ├── pinentry_debug.h ├── pinentry_debug.cpp ├── focusframe.h ├── util.h ├── capslock_p.h ├── keyboardfocusindication.h ├── accessibility.cpp ├── capslock.h ├── accessibility.h ├── capslock.cpp ├── keyboardfocusindication.cpp ├── pinlineedit.h ├── pinentryconfirm.h ├── capslock_unix.cpp ├── focusframe.cpp ├── Makefile.am ├── qti18n.cpp └── pinentryconfirm.cpp ├── qt4 ├── document-encrypt.png ├── pinentry.qrc ├── pinlineedit.h ├── pinlineedit.cpp ├── pinentryconfirm.h ├── Makefile.am ├── pinentryconfirm.cpp └── pinentrydialog.h ├── qt5 ├── icons │ ├── pinentry.png │ ├── data-error.svg │ ├── password-generate.svg │ ├── password-generate_dark.svg │ ├── Makefile.am │ ├── hint.svg │ ├── hint_dark.svg │ ├── visibility.svg │ └── visibility_dark.svg ├── org.gnupg.pinentry-qt5.desktop.in ├── pinentryrc.qrc ├── capslock_win.cpp ├── pinentry_debug.h ├── pinentry_debug.cpp ├── focusframe.h ├── util.h ├── keyboardfocusindication.h ├── accessibility.cpp ├── capslock.h ├── accessibility.h ├── capslock.cpp ├── keyboardfocusindication.cpp ├── capslock_p.h ├── pinlineedit.h ├── pinentryconfirm.h ├── focusframe.cpp ├── Makefile.am ├── qti18n.cpp ├── pinentryconfirm.cpp └── capslock_unix.cpp ├── docker ├── build-pinentry-qt4-docker-image.sh ├── run-pinentry-qt4-build.sh └── pinentry-qt4 │ └── Dockerfile ├── secmem ├── secmem-util.h ├── Makefile.am ├── secmem.h ├── util.h ├── util.c └── secmem++.h ├── m4 ├── Makefile.am ├── ChangeLog ├── qt4.m4 ├── qt6.m4 ├── qt5.m4 └── pkg.m4 ├── THANKS ├── ChangeLog ├── autogen.rc ├── fltk ├── Makefile.am ├── icon.xpm ├── passwindow.h ├── qualitypasswindow.h ├── encrypt.xpm ├── passwindow.cxx ├── qualitypasswindow.cxx └── pinwindow.h ├── TODO ├── doc ├── Makefile.am └── HACKING ├── .gitignore ├── pinentry ├── password-cache.h ├── pinentry-curses.h ├── Makefile.am ├── pinentry-emacs.h └── password-cache.c ├── tty └── Makefile.am ├── emacs ├── Makefile.am └── pinentry-emacs.c ├── curses ├── Makefile.am └── pinentry-curses.c ├── gtk+-2 └── Makefile.am ├── gnome3 └── Makefile.am ├── efl └── Makefile.am ├── AUTHORS ├── tqt ├── Makefile.am ├── pinentrydialog.h └── secqinternal_p.h ├── README.GIT ├── README ├── acinclude.m4 └── mkinstalldirs /w32/logo-128.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/pinentry/master/w32/logo-128.bmp -------------------------------------------------------------------------------- /w32/logo-32.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/pinentry/master/w32/logo-32.bmp -------------------------------------------------------------------------------- /w32/logo-48.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/pinentry/master/w32/logo-48.bmp -------------------------------------------------------------------------------- /w32/logo-64.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/pinentry/master/w32/logo-64.bmp -------------------------------------------------------------------------------- /w32/logo-96.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/pinentry/master/w32/logo-96.bmp -------------------------------------------------------------------------------- /qt/icons/pinentry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/pinentry/master/qt/icons/pinentry.png -------------------------------------------------------------------------------- /qt4/document-encrypt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/pinentry/master/qt4/document-encrypt.png -------------------------------------------------------------------------------- /qt5/icons/pinentry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/pinentry/master/qt5/icons/pinentry.png -------------------------------------------------------------------------------- /qt4/pinentry.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | document-encrypt.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /docker/build-pinentry-qt4-docker-image.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | cd $(dirname $0) 4 | 5 | docker build -t g10-build-pinentry-qt4:centos7 pinentry-qt4 6 | -------------------------------------------------------------------------------- /secmem/secmem-util.h: -------------------------------------------------------------------------------- 1 | /* This file exists because "util.h" is such a generic name that it is 2 | likely to clash with other such files. */ 3 | #include "util.h" 4 | -------------------------------------------------------------------------------- /m4/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = curses.m4 glib.m4 gpg-error.m4 gtk.m4 iconv.m4 \ 2 | host-cpu-c-abi.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 \ 3 | libassuan.m4 pkg.m4 qt4.m4 qt5.m4 4 | -------------------------------------------------------------------------------- /qt/org.gnupg.pinentry-qt.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Pinentry 3 | Type=Application 4 | Categories=Qt;Utility; 5 | Exec=@prefix@/bin/pinentry-qt 6 | NoDisplay=true 7 | Icon=pinentry 8 | GenericName=Utility for entering GnuPG secrets 9 | X-KDE-Wayland-Interfaces=org_kde_kwin_keystate 10 | -------------------------------------------------------------------------------- /qt5/org.gnupg.pinentry-qt5.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Pinentry 3 | Type=Application 4 | Categories=Qt;Utility; 5 | Exec=@prefix@/bin/pinentry-qt5 6 | NoDisplay=true 7 | Icon=pinentry 8 | GenericName=Utility for entering GnuPG secrets 9 | X-KDE-Wayland-Interfaces=org_kde_kwin_keystate 10 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | Alon Bar-Lev alon.barlev@gmail.com 2 | Albrecht Dress albrecht.dress@arcor.de 3 | Alexander Zangerl az at snafu.priv.at 4 | Michael Nottebrock michaelnottebrock at gmx.net 5 | Peter Eisentraut peter_e@gmx.net 6 | Tobias Koenig tokoe@kde.org 7 | Ed Marten edman007x at mac com 8 | -------------------------------------------------------------------------------- /qt/pinentryrc.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icons/data-error.svg 5 | icons/pinentry.png 6 | icons/hint.svg 7 | icons/password-generate.svg 8 | icons/visibility.svg 9 | icons/hint_dark.svg 10 | icons/password-generate_dark.svg 11 | icons/visibility_dark.svg 12 | 13 | 14 | -------------------------------------------------------------------------------- /qt5/pinentryrc.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icons/data-error.svg 5 | icons/pinentry.png 6 | icons/hint.svg 7 | icons/password-generate.svg 8 | icons/visibility.svg 9 | icons/hint_dark.svg 10 | icons/password-generate_dark.svg 11 | icons/visibility_dark.svg 12 | 13 | 14 | -------------------------------------------------------------------------------- /qt/icons/data-error.svg: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /qt5/icons/data-error.svg: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | No more ChangeLog files 2 | ======================== 3 | 4 | Do not modify any of the ChangeLog files in Pinentry. Starting on 5 | August 8, 2012 we put change information only in the GIT commit log, 6 | and generate a top-level ChangeLog file from logs at "make dist" time. 7 | As such, there are strict requirements on the form of the commit log 8 | messages. See doc/HACKING for details. The old ChangeLog files have 9 | all be renamed to ChangeLog-old. 10 | 11 | 12 | Local Variables: 13 | buffer-read-only: t 14 | mode: text 15 | End: 16 | -------------------------------------------------------------------------------- /qt/icons/password-generate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /qt5/icons/password-generate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /qt/icons/password-generate_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /qt5/icons/password-generate_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /autogen.rc: -------------------------------------------------------------------------------- 1 | # autogen.sh configuration for Pinentry -*- sh -*- 2 | 3 | #version_parts=3 4 | 5 | case "$myhost:$myhostsub" in 6 | w32:ce) 7 | extraoptions="--disable-pinentry-gtk2 --disable-pinentry-qt" 8 | ;; 9 | w32:) 10 | extraoptions="" 11 | ;; 12 | esac 13 | 14 | case "$myhost" in 15 | w32) 16 | configure_opts=" 17 | --with-libiconv-prefix=@SYSROOT@ 18 | PKG_CONFIG_LIBDIR=@SYSROOT@/lib/pkgconfig 19 | " 20 | ;; 21 | esac 22 | 23 | extra_aclocal_flags= 24 | 25 | final_info="./configure --enable-maintainer-mode && make" 26 | -------------------------------------------------------------------------------- /m4/ChangeLog: -------------------------------------------------------------------------------- 1 | 2025-09-29 gettextize 2 | 3 | * host-cpu-c-abi.m4: New file, from gettext-0.26. 4 | * iconv.m4: Upgrade to gettext-0.26. 5 | * lib-ld.m4: New file, from gettext-0.26. 6 | * lib-link.m4: New file, from gettext-0.26. 7 | * lib-prefix.m4: New file, from gettext-0.26. 8 | * Makefile.am (EXTRA_DIST): Add the new files. 9 | 10 | 2010-04-14 Werner Koch 11 | 12 | * pkg.m4: New. 13 | 14 | 2004-12-22 Werner Koch 15 | 16 | * gtk.m4, glib.m4, qt.m4: Fixed for automake 1.9 17 | 18 | 2004-09-27 Marcus Brinkmann 19 | 20 | * curses.m4, glib.m4, gtk.m4, iconv.m4, qt.m4: New files. 21 | 22 | 23 | -------------------------------------------------------------------------------- /fltk/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - PIN entry FLTK frontend. 2 | # SPDX-License-Identifier: GPL-2.0+ 3 | 4 | bin_PROGRAMS = pinentry-fltk 5 | 6 | if FALLBACK_CURSES 7 | ncurses_include = $(NCURSES_INCLUDE) 8 | libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV) 9 | else 10 | ncurses_include = 11 | libcurses = 12 | endif 13 | 14 | AM_CPPFLAGS = $(COMMON_CFLAGS) $(FLTKCXXFLAGS) $(ncurses_include) -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry 15 | AM_CXXFLAGS = -std=c++11 16 | LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a $(COMMON_LIBS) $(FLTKLIBS) $(libcurses) 17 | 18 | pinentry_fltk_SOURCES = main.cxx pinwindow.cxx pinwindow.h \ 19 | passwindow.cxx passwindow.h \ 20 | qualitypasswindow.cxx qualitypasswindow.h 21 | 22 | EXTRA_DIST = encrypt.xpm icon.xpm 23 | -------------------------------------------------------------------------------- /docker/run-pinentry-qt4-build.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | set -e 4 | 5 | if [ "$1" = "--devel" ]; then 6 | devmode= 7 | else 8 | devmode=1 9 | fi 10 | 11 | sourcedir=$(cd $(dirname $0)/..; pwd) 12 | 13 | if [ -z "$devmode" ]; then 14 | buildroot="/tmp/build-pinentry-qt4.$(id -un).d" 15 | [ -d "$buildroot" ] || mkdir "$buildroot" 16 | else 17 | buildroot=$(mktemp -d --tmpdir build-pinentry-qt4.XXXXXXXXXX) 18 | fi 19 | echo Using ${buildroot} 20 | 21 | 22 | docker run -it --rm --user "$(id -u):$(id -g)" \ 23 | --volume ${sourcedir}:/src \ 24 | --volume ${buildroot}:/build \ 25 | g10-build-pinentry-qt4:centos7 26 | 27 | echo "You can find the build in ${buildroot} (if the build succeeded)." 28 | 29 | # Unpack the tarball of pinentry and then ./configure and make to test 30 | # building pinentry for Qt4. 31 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | * The DISPLAY setting should be honoured by the pinentry applications 2 | using XFree86. This implies reconfiguring the underlying toolkit, 3 | is this always possible? 4 | (This is not so important, as pinentry is always restarted.) 5 | 6 | * The Qt and curses PIN entry should support enhanced mode (when it is 7 | implemented in gpg-agent). We need to agree on a protocol to use 8 | anyway. 9 | 10 | * The Qt pinentry uses QT's private QTextLayout. 11 | 12 | * Set the max length of password globally (dynamically in protocol?). 13 | 14 | * A heartbeat status message should be sent every few seconds, so that 15 | the gpg-agent is better able to cope with jammed pinentries. 16 | 17 | * The gtk+-2 pinentry needs auditing. 18 | 19 | * Implement the one_button feature in Qt. 20 | 21 | * The format of the Assuan protocol description should be changed to 22 | the one used by GnuPG. 23 | 24 | * The SETTITLE command is only implemented for GTK+-2 25 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2002 g10 Code GmbH 2 | # 3 | # This file is part of PINENTRY. 4 | # 5 | # PINENTRY is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # PINENTRY is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 18 | 19 | ## Process this file with automake to produce Makefile.in 20 | 21 | EXTRA_DIST = HACKING 22 | 23 | info_TEXINFOS = pinentry.texi 24 | 25 | pinentry_TEXINFOS = gpl.texi 26 | 27 | DISTCLEANFILES = pinentry.tmp pinentry.ops 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.lo 2 | *.o 3 | .deps/ 4 | .libs/ 5 | /aclocal.m4 6 | /autom4te.cache 7 | /config.h.in 8 | /config.h 9 | /config.log 10 | /config.status 11 | /configure 12 | /Makefile.in 13 | /VERSION 14 | autom4te.cache/ 15 | assuan/Makefile.in 16 | assuan/Makefile 17 | curses/Makefile.in 18 | curses/Makefile 19 | doc/Makefile.in 20 | doc/Makefile 21 | doc/pinentry.info 22 | doc/stamp-vti 23 | doc/version.texi 24 | efl/Makefile.in 25 | efl/Makefile 26 | fltk/Makefile.in 27 | fltk/Makefile 28 | gtk+-2/Makefile.in 29 | gtk+-2/Makefile 30 | gnome3/Makefile.in 31 | gnome3/Makefile 32 | pinentry/Makefile.in 33 | pinentry/Makefile 34 | qt/Makefile.in 35 | qt/Makefile 36 | qt/icons/Makefile.in 37 | qt/icons/Makefile 38 | qt4/Makefile.in 39 | qt4/Makefile 40 | qt5/Makefile.in 41 | qt5/icons/Makefile.in 42 | tqt/Makefile.in 43 | tqt/Makefile 44 | secmem/Makefile.in 45 | secmem/Makefile 46 | w32/Makefile.in 47 | w32/Makefile 48 | tty/Makefile.in 49 | tty/Makefile 50 | /qt/pinentryconfirm.moc 51 | /qt/pinentrydialog.moc 52 | /qt/qsecurelineedit.moc 53 | /m4/Makefile.in 54 | /emacs/Makefile.in 55 | -------------------------------------------------------------------------------- /secmem/Makefile.am: -------------------------------------------------------------------------------- 1 | # Secure Memory Makefile 2 | # Copyright (C) 2002 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | noinst_LIBRARIES = libsecmem.a 23 | 24 | libsecmem_a_SOURCES = \ 25 | secmem.h \ 26 | secmem-util.h \ 27 | util.h \ 28 | secmem.c \ 29 | util.c \ 30 | secmem++.h 31 | -------------------------------------------------------------------------------- /w32/resource.h: -------------------------------------------------------------------------------- 1 | /* resource.h 2 | * Copyright 2004 g10 Code GmbH 3 | * 4 | * This file is free software; as a special exception the author gives 5 | * unlimited permission to copy and/or distribute it, with or without 6 | * modifications, as long as this notice is preserved. 7 | * 8 | * This file is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 10 | * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | * SPDX-License-Identifier: FSFULLR 12 | */ 13 | 14 | #define IDD_PINENT 101 15 | #define IDC_PINENT_TEXT 292 16 | #define IDC_PINENT_DESC 1000 17 | #define IDC_PINENT_ERR 1001 18 | #define IDC_PINENT_PROMPT 1002 19 | #define IDC_PINENT_ICON 1003 20 | 21 | #define IDB_ICON_32 3101 22 | #define IDB_ICON_48 3102 23 | #define IDB_ICON_64 3103 24 | #define IDB_ICON_96 3104 25 | #define IDB_ICON_128 3105 26 | -------------------------------------------------------------------------------- /qt/capslock_win.cpp: -------------------------------------------------------------------------------- 1 | /* capslock_win.cpp - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #include "capslock.h" 22 | 23 | #include 24 | 25 | LockState capsLockState() 26 | { 27 | return (GetKeyState(VK_CAPITAL) & 1) ? LockState::On : LockState::Off; 28 | } 29 | -------------------------------------------------------------------------------- /qt5/capslock_win.cpp: -------------------------------------------------------------------------------- 1 | /* capslock_win.cpp - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #include "capslock.h" 22 | 23 | #include 24 | 25 | LockState capsLockState() 26 | { 27 | return (GetKeyState(VK_CAPITAL) & 1) ? LockState::On : LockState::Off; 28 | } 29 | -------------------------------------------------------------------------------- /qt/pinentry_debug.h: -------------------------------------------------------------------------------- 1 | /* pinentry_debug.h - Logging category for pinentry 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_DEBUG_H__ 22 | #define __PINENTRY_QT_DEBUG_H__ 23 | 24 | #include 25 | 26 | Q_DECLARE_LOGGING_CATEGORY(PINENTRY_LOG) 27 | 28 | #endif // __PINENTRY_QT_DEBUG_H__ 29 | -------------------------------------------------------------------------------- /qt5/pinentry_debug.h: -------------------------------------------------------------------------------- 1 | /* pinentry_debug.h - Logging category for pinentry 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_DEBUG_H__ 22 | #define __PINENTRY_QT_DEBUG_H__ 23 | 24 | #include 25 | 26 | Q_DECLARE_LOGGING_CATEGORY(PINENTRY_LOG) 27 | 28 | #endif // __PINENTRY_QT_DEBUG_H__ 29 | -------------------------------------------------------------------------------- /pinentry/password-cache.h: -------------------------------------------------------------------------------- 1 | /* password-cache.h - Password cache support interfaces. 2 | Copyright (C) 2015 g10 Code GmbH 3 | 4 | This file is part of PINENTRY. 5 | 6 | PINENTRY is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | PINENTRY is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, see . 18 | SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef PASSWORD_CACHE_H 22 | #define PASSWORD_CACHE_H 23 | 24 | void password_cache_save (const char *key_grip, const char *password); 25 | 26 | char *password_cache_lookup (const char *key_grip, int *fatal_error); 27 | 28 | int password_cache_clear (const char *keygrip); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /tty/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - PIN entry tty frontend. 2 | # Copyright (C) 2002, 2015 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | bin_PROGRAMS = pinentry-tty 23 | 24 | AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry 25 | LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \ 26 | $(COMMON_LIBS) $(LIBICONV) 27 | 28 | pinentry_tty_SOURCES = pinentry-tty.c 29 | -------------------------------------------------------------------------------- /emacs/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - PIN entry emacs frontend. 2 | # Copyright (C) 2002, 2015 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | bin_PROGRAMS = pinentry-emacs 23 | 24 | AM_CPPFLAGS = $(COMMON_CFLAGS) $(NEMACS_INCLUDE) -I$(top_srcdir)/pinentry 25 | LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \ 26 | $(COMMON_LIBS) $(LIBEMACS) $(LIBICONV) 27 | 28 | pinentry_emacs_SOURCES = pinentry-emacs.c 29 | -------------------------------------------------------------------------------- /qt5/icons/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am 2 | # Copyright (C) 2022 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | EXTRA_DIST = data-error.svg \ 23 | pinentry.png \ 24 | hint.svg \ 25 | password-generate.svg \ 26 | visibility.svg \ 27 | hint_dark.svg \ 28 | password-generate_dark.svg \ 29 | visibility_dark.svg 30 | 31 | icons_DATA = pinentry.png 32 | iconsdir = $(datadir)/pixmaps 33 | -------------------------------------------------------------------------------- /pinentry/pinentry-curses.h: -------------------------------------------------------------------------------- 1 | /* pinentry-curses.h - A secure curses dialog for PIN entry, library version 2 | * Copyright (C) 2002 g10 Code GmbH 3 | * 4 | * This file is part of PINENTRY. 5 | * 6 | * PINENTRY is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * PINENTRY is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | #ifndef PINENTRY_CURSES_H 21 | #define PINENTRY_CURSES_H 22 | 23 | #include "pinentry.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | int curses_cmd_handler (pinentry_t pinentry); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* PINENTRY_CURSES_H */ 36 | -------------------------------------------------------------------------------- /qt/icons/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am 2 | # Copyright (C) 2022 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | EXTRA_DIST = data-error.svg \ 23 | pinentry.png \ 24 | hint.svg \ 25 | password-generate.svg \ 26 | visibility.svg \ 27 | hint_dark.svg \ 28 | password-generate_dark.svg \ 29 | visibility_dark.svg 30 | 31 | icons_DATA = pinentry.png 32 | iconsdir = $(datadir)/pixmaps 33 | -------------------------------------------------------------------------------- /qt4/pinlineedit.h: -------------------------------------------------------------------------------- 1 | /* pinlineedit.h - Modified QLineEdit widget. 2 | * Copyright (C) 2018 Damien Goutte-Gattat 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | * SPDX-License-Identifier: GPL-2.0+ 17 | */ 18 | 19 | #ifndef _PINLINEEDIT_H_ 20 | #define _PINLINEEDIT_H_ 21 | 22 | #include 23 | 24 | class PinLineEdit : public QLineEdit 25 | { 26 | Q_OBJECT 27 | 28 | public: 29 | PinLineEdit(QWidget *); 30 | 31 | signals: 32 | void backspacePressed(); 33 | 34 | protected: 35 | void keyPressEvent(QKeyEvent *); 36 | }; 37 | 38 | #endif // _PINLINEEDIT_H_ 39 | -------------------------------------------------------------------------------- /qt/pinentry_debug.cpp: -------------------------------------------------------------------------------- 1 | /* pinentry_debug.h - Logging category for pinentry 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | #endif 24 | 25 | #include "pinentry_debug.h" 26 | 27 | #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) 28 | Q_LOGGING_CATEGORY(PINENTRY_LOG, "gpg.pinentry", QtWarningMsg) 29 | #else 30 | Q_LOGGING_CATEGORY(PINENTRY_LOG, "gpg.pinentry") 31 | #endif 32 | -------------------------------------------------------------------------------- /qt5/pinentry_debug.cpp: -------------------------------------------------------------------------------- 1 | /* pinentry_debug.h - Logging category for pinentry 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | #endif 24 | 25 | #include "pinentry_debug.h" 26 | 27 | #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) 28 | Q_LOGGING_CATEGORY(PINENTRY_LOG, "gpg.pinentry", QtWarningMsg) 29 | #else 30 | Q_LOGGING_CATEGORY(PINENTRY_LOG, "gpg.pinentry") 31 | #endif 32 | -------------------------------------------------------------------------------- /qt4/pinlineedit.cpp: -------------------------------------------------------------------------------- 1 | /* pinlineedit.cpp - Modified QLineEdit widget. 2 | * Copyright (C) 2018 Damien Goutte-Gattat 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | * SPDX-License-Identifier: GPL-2.0+ 17 | */ 18 | 19 | #include "pinlineedit.h" 20 | 21 | #include 22 | 23 | PinLineEdit::PinLineEdit(QWidget *parent) : QLineEdit(parent) 24 | { 25 | } 26 | 27 | void 28 | PinLineEdit::keyPressEvent(QKeyEvent *e) 29 | { 30 | QLineEdit::keyPressEvent(e); 31 | 32 | if ( e->key() == Qt::Key_Backspace ) 33 | emit backspacePressed(); 34 | } 35 | 36 | #include "pinlineedit.moc" 37 | -------------------------------------------------------------------------------- /qt/focusframe.h: -------------------------------------------------------------------------------- 1 | /* focusframe.h - A focus indicator for labels. 2 | * Copyright (C) 2022 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __FOCUSFRAME_H__ 22 | #define __FOCUSFRAME_H__ 23 | 24 | #include 25 | 26 | class FocusFrame : public QFocusFrame 27 | { 28 | Q_OBJECT 29 | public: 30 | using QFocusFrame::QFocusFrame; 31 | 32 | protected: 33 | void paintEvent(QPaintEvent *event) override; 34 | }; 35 | 36 | #endif // __FOCUSFRAME_H__ 37 | -------------------------------------------------------------------------------- /qt5/focusframe.h: -------------------------------------------------------------------------------- 1 | /* focusframe.h - A focus indicator for labels. 2 | * Copyright (C) 2022 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __FOCUSFRAME_H__ 22 | #define __FOCUSFRAME_H__ 23 | 24 | #include 25 | 26 | class FocusFrame : public QFocusFrame 27 | { 28 | Q_OBJECT 29 | public: 30 | using QFocusFrame::QFocusFrame; 31 | 32 | protected: 33 | void paintEvent(QPaintEvent *event) override; 34 | }; 35 | 36 | #endif // __FOCUSFRAME_H__ 37 | -------------------------------------------------------------------------------- /curses/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - PIN entry curses frontend. 2 | # Copyright (C) 2002, 2015 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | bin_PROGRAMS = pinentry-curses 23 | 24 | AM_CPPFLAGS = $(COMMON_CFLAGS) $(NCURSES_INCLUDE) -I$(top_srcdir)/pinentry 25 | LDADD = ../pinentry/libpinentry.a ../pinentry/libpinentry-curses.a \ 26 | ../secmem/libsecmem.a $(COMMON_LIBS) $(LIBCURSES) $(LIBICONV) 27 | 28 | pinentry_curses_SOURCES = pinentry-curses.c 29 | -------------------------------------------------------------------------------- /fltk/icon.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char *const icon_xpm[] = { 3 | "31 29 3 1 ", 4 | " c black", 5 | ". c yellow", 6 | "X c None", 7 | 8 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 9 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 10 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 11 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 12 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 13 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 14 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 15 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 16 | " XXXXXXXXXXXXXXXXXX", 17 | " ........... XXXXXXXXXXXXXXXXXX", 18 | " ........... XXXXXXXXXXXXXXXXXX", 19 | " ... ... XXXXXXXXXXXXXXXXXX", 20 | " ... XXX ... ", 21 | " ... XXX ... ................. ", 22 | " ... XXX ... ................. ", 23 | " ... XXX ... ... ... ", 24 | " ... ... XXXXXXX ... X ... ", 25 | " ........... XXXXXXX ... X ... ", 26 | " ........... XXXXXXX X ... ", 27 | " XXXXXXXXXXXXX ", 28 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 29 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 30 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 31 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 32 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 33 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 34 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 35 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 36 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 37 | }; 38 | -------------------------------------------------------------------------------- /qt/icons/hint.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /qt5/icons/hint.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /qt/icons/hint_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /qt5/icons/hint_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /qt/util.h: -------------------------------------------------------------------------------- 1 | /* util.h - Helper for managing malloced pointers 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_UTIL_H__ 22 | #define __PINENTRY_QT_UTIL_H__ 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace _detail 29 | { 30 | struct FreeDeleter { 31 | void operator()(void *ptr) const { 32 | free(ptr); 33 | } 34 | }; 35 | } 36 | 37 | template 38 | using unique_malloced_ptr = std::unique_ptr; 39 | 40 | #endif // __PINENTRY_QT_UTIL_H__ 41 | -------------------------------------------------------------------------------- /qt5/util.h: -------------------------------------------------------------------------------- 1 | /* util.h - Helper for managing malloced pointers 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_UTIL_H__ 22 | #define __PINENTRY_QT_UTIL_H__ 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace _detail 29 | { 30 | struct FreeDeleter { 31 | void operator()(void *ptr) const { 32 | free(ptr); 33 | } 34 | }; 35 | } 36 | 37 | template 38 | using unique_malloced_ptr = std::unique_ptr; 39 | 40 | #endif // __PINENTRY_QT_UTIL_H__ 41 | -------------------------------------------------------------------------------- /curses/pinentry-curses.c: -------------------------------------------------------------------------------- 1 | /* pinentry-curses.c - A secure curses dialog for PIN entry. 2 | Copyright (C) 2002 g10 Code GmbH 3 | 4 | This file is part of PINENTRY. 5 | 6 | PINENTRY is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | PINENTRY is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | 28 | #include "pinentry.h" 29 | #include "pinentry-curses.h" 30 | 31 | pinentry_cmd_handler_t pinentry_cmd_handler = curses_cmd_handler; 32 | 33 | 34 | int 35 | main (int argc, char *argv[]) 36 | { 37 | pinentry_init ("pinentry-curses"); 38 | 39 | pinentry_parse_opts (argc, argv); 40 | 41 | if (pinentry_loop ()) 42 | return 1; 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /gtk+-2/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - PIN entry GTK+ frontend. 2 | # Copyright (C) 2002, 2015 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | bin_PROGRAMS = pinentry-gtk-2 23 | 24 | if FALLBACK_CURSES 25 | ncurses_include = $(NCURSES_INCLUDE) 26 | libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV) 27 | else 28 | ncurses_include = 29 | libcurses = 30 | endif 31 | 32 | AM_CPPFLAGS = $(COMMON_CFLAGS) $(GTK2_CFLAGS) $(ncurses_include) \ 33 | -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry 34 | LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \ 35 | $(COMMON_LIBS) $(GTK2_LIBS) $(libcurses) 36 | 37 | pinentry_gtk_2_SOURCES = pinentry-gtk-2.c 38 | -------------------------------------------------------------------------------- /gnome3/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - PIN entry GTK+ frontend. 2 | # Copyright (C) 2002, 2015 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | bin_PROGRAMS = pinentry-gnome3 23 | 24 | if FALLBACK_CURSES 25 | ncurses_include = $(NCURSES_INCLUDE) 26 | libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV) 27 | else 28 | ncurses_include = 29 | libcurses = 30 | endif 31 | 32 | AM_CPPFLAGS = $(COMMON_CFLAGS) $(GNOME3_CFLAGS) \ 33 | $(ncurses_include) -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry 34 | LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \ 35 | $(COMMON_LIBS) $(GNOME3_LIBS) $(libcurses) 36 | 37 | pinentry_gnome3_SOURCES = pinentry-gnome3.c 38 | -------------------------------------------------------------------------------- /emacs/pinentry-emacs.c: -------------------------------------------------------------------------------- 1 | /* pinentry-emacs.c - A secure emacs dialog for PIN entry, library version 2 | * Copyright (C) 2015 Daiki Ueno 3 | * 4 | * This file is part of PINENTRY. 5 | * 6 | * PINENTRY is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * PINENTRY is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | 28 | #include "pinentry.h" 29 | #include "pinentry-emacs.h" 30 | 31 | pinentry_cmd_handler_t pinentry_cmd_handler = emacs_cmd_handler; 32 | 33 | 34 | 35 | int 36 | main (int argc, char *argv[]) 37 | { 38 | pinentry_init ("pinentry-emacs"); 39 | 40 | pinentry_parse_opts (argc, argv); 41 | 42 | if (!pinentry_emacs_init ()) 43 | return 1; 44 | 45 | if (pinentry_loop ()) 46 | return 1; 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /qt/capslock_p.h: -------------------------------------------------------------------------------- 1 | /* capslock_p.h - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_CAPSLOCK_P_H__ 22 | #define __PINENTRY_QT_CAPSLOCK_P_H__ 23 | 24 | #include "capslock.h" 25 | 26 | #if PINENTRY_KGUIADDONS 27 | #include 28 | #endif 29 | 30 | class CapsLockWatcher::Private 31 | { 32 | public: 33 | explicit Private(CapsLockWatcher *); 34 | 35 | #if PINENTRY_KGUIADDONS 36 | void watch(); 37 | KModifierKeyInfo *keyInfo = nullptr; 38 | #endif 39 | private: 40 | 41 | private: 42 | CapsLockWatcher *const q; 43 | }; 44 | 45 | #endif // __PINENTRY_QT_CAPSLOCK_P_H__ 46 | -------------------------------------------------------------------------------- /qt/keyboardfocusindication.h: -------------------------------------------------------------------------------- 1 | /* keyboardfocusindication.h - Helper for extended keyboard focus indication. 2 | * Copyright (C) 2022 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __KEYBOARDFOCUSINDICATION_H__ 22 | #define __KEYBOARDFOCUSINDICATION_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class FocusFrame; 29 | 30 | class KeyboardFocusIndication : public QObject 31 | { 32 | Q_OBJECT 33 | public: 34 | KeyboardFocusIndication(QObject *parent); 35 | 36 | private: 37 | void updateFocusFrame(QWidget *, QWidget *); 38 | 39 | QPointer focusFrame; 40 | }; 41 | 42 | #endif // __KEYBOARDFOCUSINDICATION_H__ 43 | -------------------------------------------------------------------------------- /qt5/keyboardfocusindication.h: -------------------------------------------------------------------------------- 1 | /* keyboardfocusindication.h - Helper for extended keyboard focus indication. 2 | * Copyright (C) 2022 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __KEYBOARDFOCUSINDICATION_H__ 22 | #define __KEYBOARDFOCUSINDICATION_H__ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class FocusFrame; 29 | 30 | class KeyboardFocusIndication : public QObject 31 | { 32 | Q_OBJECT 33 | public: 34 | KeyboardFocusIndication(QObject *parent); 35 | 36 | private: 37 | void updateFocusFrame(QWidget *, QWidget *); 38 | 39 | QPointer focusFrame; 40 | }; 41 | 42 | #endif // __KEYBOARDFOCUSINDICATION_H__ 43 | -------------------------------------------------------------------------------- /qt/accessibility.cpp: -------------------------------------------------------------------------------- 1 | /* accessibility.cpp - Helpers for making pinentry accessible 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #include "accessibility.h" 22 | 23 | #include 24 | #include 25 | 26 | namespace Accessibility 27 | { 28 | 29 | void setDescription(QWidget *w, const QString &text) 30 | { 31 | if (w) { 32 | #ifndef QT_NO_ACCESSIBILITY 33 | w->setAccessibleDescription(text); 34 | #endif 35 | } 36 | } 37 | 38 | void setName(QWidget *w, const QString &text) 39 | { 40 | if (w) { 41 | #ifndef QT_NO_ACCESSIBILITY 42 | w->setAccessibleName(text); 43 | #endif 44 | } 45 | } 46 | 47 | } // namespace Accessibility 48 | -------------------------------------------------------------------------------- /qt5/accessibility.cpp: -------------------------------------------------------------------------------- 1 | /* accessibility.cpp - Helpers for making pinentry accessible 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #include "accessibility.h" 22 | 23 | #include 24 | #include 25 | 26 | namespace Accessibility 27 | { 28 | 29 | void setDescription(QWidget *w, const QString &text) 30 | { 31 | if (w) { 32 | #ifndef QT_NO_ACCESSIBILITY 33 | w->setAccessibleDescription(text); 34 | #endif 35 | } 36 | } 37 | 38 | void setName(QWidget *w, const QString &text) 39 | { 40 | if (w) { 41 | #ifndef QT_NO_ACCESSIBILITY 42 | w->setAccessibleName(text); 43 | #endif 44 | } 45 | } 46 | 47 | } // namespace Accessibility 48 | -------------------------------------------------------------------------------- /qt4/pinentryconfirm.h: -------------------------------------------------------------------------------- 1 | /* pinentryconfirm.h - A QMessageBox with a timeout 2 | * 3 | * Copyright (C) 2011 Ben Kibbey 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see . 17 | * SPDX-License-Identifier: GPL-2.0+ 18 | */ 19 | 20 | #ifndef PINENTRYCONFIRM_H 21 | #define PINENTRYCONFIRM_H 22 | 23 | #include 24 | #include 25 | 26 | class PinentryConfirm : public QMessageBox 27 | { 28 | Q_OBJECT 29 | public: 30 | PinentryConfirm(Icon, int timeout, const QString &title, 31 | const QString &desc, StandardButtons buttons, 32 | QWidget *parent); 33 | bool timedOut() const; 34 | 35 | private slots: 36 | void slotTimeout(); 37 | 38 | private: 39 | QTimer *_timer; 40 | bool _timed_out; 41 | 42 | protected: 43 | /* reimp */ void showEvent(QShowEvent *event); 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /efl/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - PIN entry EFL frontend. 2 | # Copyright (C) 2017 Obsidian-Studios, Inc. 3 | # Author William L. Thomson Jr. 4 | # 5 | # This file is part of PINENTRY. 6 | # 7 | # PINENTRY is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # PINENTRY is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program; if not, write to the Free Software 19 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 20 | 21 | ## Process this file with automake to produce Makefile.in 22 | 23 | bin_PROGRAMS = pinentry-efl 24 | 25 | if FALLBACK_CURSES 26 | ncurses_include = $(NCURSES_INCLUDE) 27 | libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV) 28 | else 29 | ncurses_include = 30 | libcurses = 31 | endif 32 | 33 | AM_CPPFLAGS = $(COMMON_CFLAGS) $(EFL_CFLAGS) $(ncurses_include) \ 34 | -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry 35 | LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \ 36 | $(COMMON_LIBS) $(EFL_LIBS) $(libcurses) 37 | 38 | pinentry_efl_SOURCES = pinentry-efl.c 39 | -------------------------------------------------------------------------------- /qt/icons/visibility.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 11 | 13 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /qt5/icons/visibility.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 11 | 13 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /qt/icons/visibility_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 11 | 13 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /qt5/icons/visibility_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 11 | 13 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /qt/capslock.h: -------------------------------------------------------------------------------- 1 | /* capslock.h - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_CAPSLOCK_H__ 22 | #define __PINENTRY_QT_CAPSLOCK_H__ 23 | 24 | #include 25 | 26 | #include 27 | 28 | enum class LockState 29 | { 30 | Unknown = -1, 31 | Off, 32 | On 33 | }; 34 | 35 | LockState capsLockState(); 36 | 37 | class CapsLockWatcher : public QObject 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit CapsLockWatcher(QObject *parent = nullptr); 43 | 44 | Q_SIGNALS: 45 | void stateChanged(bool locked); 46 | 47 | private: 48 | class Private; 49 | std::unique_ptr d; 50 | }; 51 | 52 | #endif // __PINENTRY_QT_CAPSLOCK_H__ 53 | -------------------------------------------------------------------------------- /qt5/capslock.h: -------------------------------------------------------------------------------- 1 | /* capslock.h - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_CAPSLOCK_H__ 22 | #define __PINENTRY_QT_CAPSLOCK_H__ 23 | 24 | #include 25 | 26 | #include 27 | 28 | enum class LockState 29 | { 30 | Unknown = -1, 31 | Off, 32 | On 33 | }; 34 | 35 | LockState capsLockState(); 36 | 37 | class CapsLockWatcher : public QObject 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit CapsLockWatcher(QObject *parent = nullptr); 43 | 44 | Q_SIGNALS: 45 | void stateChanged(bool locked); 46 | 47 | private: 48 | class Private; 49 | std::unique_ptr d; 50 | }; 51 | 52 | #endif // __PINENTRY_QT_CAPSLOCK_H__ 53 | -------------------------------------------------------------------------------- /qt/accessibility.h: -------------------------------------------------------------------------------- 1 | /* accessibility.h - Helpers for making pinentry accessible 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_ACCESSIBILITY_H__ 22 | #define __PINENTRY_QT_ACCESSIBILITY_H__ 23 | 24 | class QString; 25 | class QWidget; 26 | 27 | namespace Accessibility 28 | { 29 | 30 | /* Wrapper for QWidget::setAccessibleDescription which does nothing if 31 | QT_NO_ACCESSIBILITY is defined. */ 32 | void setDescription(QWidget *w, const QString &text); 33 | 34 | /* Wrapper for QWidget::setAccessibleName which does nothing if 35 | QT_NO_ACCESSIBILITY is defined. */ 36 | void setName(QWidget *w, const QString &text); 37 | 38 | } // namespace Accessibility 39 | 40 | #endif // __PINENTRY_QT_ACCESSIBILITY_H__ 41 | -------------------------------------------------------------------------------- /qt5/accessibility.h: -------------------------------------------------------------------------------- 1 | /* accessibility.h - Helpers for making pinentry accessible 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_ACCESSIBILITY_H__ 22 | #define __PINENTRY_QT_ACCESSIBILITY_H__ 23 | 24 | class QString; 25 | class QWidget; 26 | 27 | namespace Accessibility 28 | { 29 | 30 | /* Wrapper for QWidget::setAccessibleDescription which does nothing if 31 | QT_NO_ACCESSIBILITY is defined. */ 32 | void setDescription(QWidget *w, const QString &text); 33 | 34 | /* Wrapper for QWidget::setAccessibleName which does nothing if 35 | QT_NO_ACCESSIBILITY is defined. */ 36 | void setName(QWidget *w, const QString &text); 37 | 38 | } // namespace Accessibility 39 | 40 | #endif // __PINENTRY_QT_ACCESSIBILITY_H__ 41 | -------------------------------------------------------------------------------- /w32/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am - PIN entry W32 2 | # Copyright (C) 2004 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | logos = logo-32.bmp logo-48.bmp logo-64.bmp logo-96.bmp logo-128.bmp 23 | 24 | EXTRA_DIST = $(logos) 25 | 26 | bin_PROGRAMS = pinentry-w32 27 | 28 | AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(top_srcdir)/secmem \ 29 | -I$(top_srcdir)/pinentry 30 | 31 | 32 | pinentry_w32_SOURCES = main.c pinentry-w32.rc resource.h 33 | 34 | # Note: For testing you should add -mconsole to LDFLAGS. 35 | pinentry_w32_LDFLAGS = -mwindows 36 | pinentry_w32_LDADD = pinentry-w32.o \ 37 | ../pinentry/libpinentry.a ../secmem/libsecmem.a \ 38 | $(COMMON_LIBS) 39 | 40 | pinentry-w32.o: pinentry-w32.rc resource.h $(logos) 41 | $(WINDRES) -I.. -v -o $@ $< 42 | 43 | -------------------------------------------------------------------------------- /pinentry/Makefile.am: -------------------------------------------------------------------------------- 1 | # Pinentry support library Makefile 2 | # Copyright (C) 2002, 2015 g10 Code GmbH 3 | # 4 | # This file is part of PINENTRY. 5 | # 6 | # PINENTRY is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # PINENTRY is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, see . 18 | # SPDX-License-Identifier: GPL-2.0+ 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | EXTRA_DIST = 23 | 24 | if BUILD_LIBPINENTRY_CURSES 25 | pinentry_curses = libpinentry-curses.a 26 | else 27 | pinentry_curses = 28 | endif 29 | 30 | if BUILD_LIBPINENTRY_EMACS 31 | pinentry_emacs_sources = pinentry-emacs.h pinentry-emacs.c 32 | else 33 | pinentry_emacs_sources = 34 | endif 35 | 36 | noinst_LIBRARIES = libpinentry.a $(pinentry_curses) 37 | 38 | LDADD = $(COMMON_LIBS) 39 | AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(top_srcdir)/secmem 40 | 41 | libpinentry_a_SOURCES = pinentry.h pinentry.c argparse.c argparse.h \ 42 | password-cache.h password-cache.c $(pinentry_emacs_sources) 43 | libpinentry_curses_a_SOURCES = pinentry-curses.h pinentry-curses.c 44 | libpinentry_curses_a_CFLAGS = @NCURSES_CFLAGS@ 45 | -------------------------------------------------------------------------------- /qt/capslock.cpp: -------------------------------------------------------------------------------- 1 | /* capslock.cpp - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | #endif 24 | 25 | #include "capslock.h" 26 | #include "capslock_p.h" 27 | 28 | #include 29 | 30 | #include 31 | 32 | CapsLockWatcher::Private::Private(CapsLockWatcher *q) 33 | : q{q} 34 | { 35 | #if PINENTRY_KGUIADDONS 36 | watch(); 37 | #endif 38 | } 39 | 40 | CapsLockWatcher::CapsLockWatcher(QObject *parent) 41 | : QObject{parent} 42 | , d{new Private{this}} 43 | { 44 | if (qApp->platformName() == QLatin1String("wayland") || qApp->platformName() == QLatin1String("xcb")) { 45 | #if ! PINENTRY_KGUIADDONS 46 | qWarning() << "CapsLockWatcher was compiled without support for unix"; 47 | #endif 48 | } 49 | } 50 | 51 | #include "capslock.moc" 52 | -------------------------------------------------------------------------------- /pinentry/pinentry-emacs.h: -------------------------------------------------------------------------------- 1 | /* pinentry-emacs.c - A secure emacs dialog for PIN entry, library version 2 | * Copyright (C) 2015 Daiki Ueno 3 | * 4 | * This file is part of PINENTRY. 5 | * 6 | * PINENTRY is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * PINENTRY is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef PINENTRY_EMACS_H 22 | #define PINENTRY_EMACS_H 23 | 24 | #include "pinentry.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Enable pinentry command handler which interacts with Emacs, if 31 | INSIDE_EMACS envvar is set. This function shall be called upon 32 | receiving an Assuan request "OPTION allow-emacs-prompt". */ 33 | void pinentry_enable_emacs_cmd_handler (void); 34 | 35 | /* Return info on whether emacs support is enabled. */ 36 | int pinentry_emacs_status (void); 37 | 38 | /* Initialize the Emacs interface, return true if success. */ 39 | int pinentry_emacs_init (void); 40 | 41 | int emacs_cmd_handler (pinentry_t pinentry); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* PINENTRY_EMACS_H */ 48 | -------------------------------------------------------------------------------- /qt5/capslock.cpp: -------------------------------------------------------------------------------- 1 | /* capslock.cpp - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | #endif 24 | 25 | #include "capslock.h" 26 | #include "capslock_p.h" 27 | 28 | #include 29 | 30 | #include 31 | 32 | CapsLockWatcher::Private::Private(CapsLockWatcher *q) 33 | : q{q} 34 | { 35 | #if PINENTRY_QT5_WAYLAND 36 | if (qApp->platformName() == QLatin1String("wayland")) { 37 | watchWayland(); 38 | } 39 | #endif 40 | } 41 | 42 | CapsLockWatcher::CapsLockWatcher(QObject *parent) 43 | : QObject{parent} 44 | , d{new Private{this}} 45 | { 46 | if (qApp->platformName() == QLatin1String("wayland")) { 47 | #ifndef PINENTRY_QT5_WAYLAND 48 | qWarning() << "CapsLockWatcher was compiled without support for Wayland"; 49 | #endif 50 | } 51 | } 52 | 53 | #include "capslock.moc" 54 | -------------------------------------------------------------------------------- /secmem/secmem.h: -------------------------------------------------------------------------------- 1 | /* Quintuple Agent secure memory allocation 2 | * Copyright (C) 1998,1999 Free Software Foundation, Inc. 3 | * Copyright (C) 1999,2000 Robert Bihlmeyer 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see . 17 | * SPDX-License-Identifier: GPL-2.0+ 18 | */ 19 | 20 | #ifndef _MEMORY_H 21 | #define _MEMORY_H 22 | 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #if 0 28 | } 29 | #endif 30 | #endif 31 | 32 | 33 | /* values for flags, hardcoded in secmem.c */ 34 | #define SECMEM_WARN 0 35 | #define SECMEM_DONT_WARN 1 36 | #define SECMEM_SUSPEND_WARN 2 37 | 38 | void secmem_init( size_t npool ); 39 | void secmem_term( void ); 40 | void *secmem_malloc( size_t size ); 41 | void *secmem_realloc( void *a, size_t newsize ); 42 | void secmem_free( void *a ); 43 | int m_is_secure( const void *p ); 44 | void secmem_dump_stats(void); 45 | void secmem_set_flags( unsigned flags ); 46 | unsigned secmem_get_flags(void); 47 | size_t secmem_get_max_size (void); 48 | 49 | #if 0 50 | { 51 | #endif 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif /* _MEMORY_H */ 56 | -------------------------------------------------------------------------------- /fltk/passwindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | passwindow.h - PassWindow is a more complex fltk dialog with more longer 3 | desc field and possibility to show some error text. 4 | if needed qualitybar - should be used QualityPassWindow. 5 | 6 | Copyright (C) 2016 Anatoly madRat L. Berenblit 7 | 8 | Written by Anatoly madRat L. Berenblit . 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License as 12 | published by the Free Software Foundation; either version 2 of the 13 | License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | SPDX-License-Identifier: GPL-2.0+ 24 | */ 25 | 26 | #ifndef __PASSWINDOW_H__ 27 | #define __PASSWINDOW_H__ 28 | 29 | #include "pinwindow.h" 30 | 31 | class PassWindow : public PinWindow 32 | { 33 | protected: 34 | static const char *DESCRIPTION; 35 | 36 | protected: 37 | Fl_Box *error_; 38 | PassWindow(); 39 | 40 | public: 41 | virtual void prompt(const char *message); 42 | virtual void description(const char *desc); 43 | virtual void error(const char *err); 44 | 45 | static PassWindow* create(); 46 | 47 | protected: 48 | virtual int init(const int cx, const int cy); 49 | }; 50 | 51 | #endif //#ifndef __PASSWINDOW_H__ 52 | -------------------------------------------------------------------------------- /doc/HACKING: -------------------------------------------------------------------------------- 1 | # HACKING -*- org -*- 2 | #+TITLE: Hacking notes for PINentry 3 | #+STARTUP: showall 4 | 5 | * No ChangeLog files 6 | 7 | Do not write ChangeLog files for Pinentry. We put change 8 | information only in the GIT commit log, and generate a top-level 9 | ChangeLog file from logs at "make dist" time. As such, there are 10 | strict requirements on the form of the commit log messages. 11 | 12 | 13 | * Commit log requirements 14 | 15 | Your commit log should always start with a one-line summary, the 16 | second line should be blank, and the remaining lines are usually 17 | ChangeLog-style entries for all affected files. However, it's fine 18 | -- even recommended -- to write a few lines of prose describing the 19 | change, when the summary and ChangeLog entries don't give enough of 20 | the big picture. Omit the leading TABs that you're used to seeing 21 | in a "real" ChangeLog file, but keep the maximum line length at 72 22 | or smaller, so that the generated ChangeLog lines, each with its 23 | leading TAB, will not exceed 80 columns. 24 | 25 | For more information please check the HACKING file from the GnuPG 26 | project. 27 | 28 | * String translation 29 | 30 | Pinentry does not not require any translation files because it 31 | expects that all strings are provided localized by the caller. This 32 | is due to the design constraint to keep the tool simple and also to 33 | make sure that translations match those of GnuPG. 34 | 35 | The available translated strings can be found in GnuPG, file 36 | agent/call-pinentry, function start_pinentry. If a string is not 37 | available the Pinentry code uses a default as a fallback. However, 38 | it is highly suggested to provide Pinentry with translated strings. 39 | -------------------------------------------------------------------------------- /qt/keyboardfocusindication.cpp: -------------------------------------------------------------------------------- 1 | /* keyboardfocusindication.cpp - Helper for extended keyboard focus indication. 2 | * Copyright (C) 2022 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #include "keyboardfocusindication.h" 22 | 23 | #include "focusframe.h" 24 | 25 | #include 26 | 27 | KeyboardFocusIndication::KeyboardFocusIndication(QObject *parent) 28 | : QObject{parent} 29 | { 30 | connect(qApp, &QApplication::focusChanged, this, &KeyboardFocusIndication::updateFocusFrame); 31 | } 32 | 33 | void KeyboardFocusIndication::updateFocusFrame(QWidget *, QWidget *focusWidget) 34 | { 35 | if (focusWidget && focusWidget->inherits("QLabel") && focusWidget->window()->testAttribute(Qt::WA_KeyboardFocusChange)) { 36 | if (!focusFrame) { 37 | focusFrame = new FocusFrame{focusWidget}; 38 | } 39 | focusFrame->setWidget(focusWidget); 40 | } else if (focusFrame) { 41 | focusFrame->setWidget(nullptr); 42 | } 43 | } 44 | 45 | #include "keyboardfocusindication.moc" 46 | -------------------------------------------------------------------------------- /qt5/keyboardfocusindication.cpp: -------------------------------------------------------------------------------- 1 | /* keyboardfocusindication.cpp - Helper for extended keyboard focus indication. 2 | * Copyright (C) 2022 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #include "keyboardfocusindication.h" 22 | 23 | #include "focusframe.h" 24 | 25 | #include 26 | 27 | KeyboardFocusIndication::KeyboardFocusIndication(QObject *parent) 28 | : QObject{parent} 29 | { 30 | connect(qApp, &QApplication::focusChanged, this, &KeyboardFocusIndication::updateFocusFrame); 31 | } 32 | 33 | void KeyboardFocusIndication::updateFocusFrame(QWidget *, QWidget *focusWidget) 34 | { 35 | if (focusWidget && focusWidget->inherits("QLabel") && focusWidget->window()->testAttribute(Qt::WA_KeyboardFocusChange)) { 36 | if (!focusFrame) { 37 | focusFrame = new FocusFrame{focusWidget}; 38 | } 39 | focusFrame->setWidget(focusWidget); 40 | } else if (focusFrame) { 41 | focusFrame->setWidget(nullptr); 42 | } 43 | } 44 | 45 | #include "keyboardfocusindication.moc" 46 | -------------------------------------------------------------------------------- /qt/pinlineedit.h: -------------------------------------------------------------------------------- 1 | /* pinlineedit.h - Modified QLineEdit widget. 2 | * Copyright (C) 2018 Damien Goutte-Gattat 3 | * Copyright (C) 2021 g10 Code GmbH 4 | * 5 | * Software engineering by Ingo Klöcker 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, see . 19 | * SPDX-License-Identifier: GPL-2.0+ 20 | */ 21 | 22 | #ifndef _PINLINEEDIT_H_ 23 | #define _PINLINEEDIT_H_ 24 | 25 | #include 26 | 27 | #include 28 | 29 | class PinLineEdit : public QLineEdit 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit PinLineEdit(QWidget *parent = nullptr); 35 | ~PinLineEdit() override; 36 | 37 | void setPin(const QString &pin); 38 | QString pin() const; 39 | 40 | public Q_SLOTS: 41 | void setFormattedPassphrase(bool on); 42 | void copy() const; 43 | void cut(); 44 | 45 | Q_SIGNALS: 46 | void backspacePressed(); 47 | 48 | protected: 49 | void keyPressEvent(QKeyEvent *) override; 50 | 51 | private: 52 | using QLineEdit::setText; 53 | using QLineEdit::text; 54 | 55 | private Q_SLOTS: 56 | void textEdited(); 57 | 58 | private: 59 | class Private; 60 | std::unique_ptr d; 61 | }; 62 | 63 | #endif // _PINLINEEDIT_H_ 64 | -------------------------------------------------------------------------------- /qt5/capslock_p.h: -------------------------------------------------------------------------------- 1 | /* capslock_p.h - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifndef __PINENTRY_QT_CAPSLOCK_P_H__ 22 | #define __PINENTRY_QT_CAPSLOCK_P_H__ 23 | 24 | #include "capslock.h" 25 | 26 | #if PINENTRY_QT5_WAYLAND 27 | namespace KWayland 28 | { 29 | namespace Client 30 | { 31 | class Registry; 32 | class Seat; 33 | } 34 | } 35 | #endif 36 | 37 | class CapsLockWatcher::Private 38 | { 39 | public: 40 | explicit Private(CapsLockWatcher *); 41 | #if PINENTRY_QT5_WAYLAND 42 | void watchWayland(); 43 | #endif 44 | 45 | private: 46 | #if PINENTRY_QT5_WAYLAND 47 | void registry_seatAnnounced(quint32, quint32); 48 | void seat_hasKeyboardChanged(bool); 49 | void keyboard_modifiersChanged(quint32); 50 | #endif 51 | 52 | private: 53 | CapsLockWatcher *const q; 54 | 55 | #if PINENTRY_QT5_WAYLAND 56 | KWayland::Client::Registry *registry = nullptr; 57 | KWayland::Client::Seat *seat = nullptr; 58 | #endif 59 | }; 60 | 61 | #endif // __PINENTRY_QT_CAPSLOCK_P_H__ 62 | -------------------------------------------------------------------------------- /qt5/pinlineedit.h: -------------------------------------------------------------------------------- 1 | /* pinlineedit.h - Modified QLineEdit widget. 2 | * Copyright (C) 2018 Damien Goutte-Gattat 3 | * Copyright (C) 2021 g10 Code GmbH 4 | * 5 | * Software engineering by Ingo Klöcker 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, see . 19 | * SPDX-License-Identifier: GPL-2.0+ 20 | */ 21 | 22 | #ifndef _PINLINEEDIT_H_ 23 | #define _PINLINEEDIT_H_ 24 | 25 | #include 26 | 27 | #include 28 | 29 | class PinLineEdit : public QLineEdit 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit PinLineEdit(QWidget *parent = nullptr); 35 | ~PinLineEdit() override; 36 | 37 | void setPin(const QString &pin); 38 | QString pin() const; 39 | 40 | public Q_SLOTS: 41 | void setFormattedPassphrase(bool on); 42 | void copy() const; 43 | void cut(); 44 | 45 | Q_SIGNALS: 46 | void backspacePressed(); 47 | 48 | protected: 49 | void keyPressEvent(QKeyEvent *) override; 50 | 51 | private: 52 | using QLineEdit::setText; 53 | using QLineEdit::text; 54 | 55 | private Q_SLOTS: 56 | void textEdited(); 57 | 58 | private: 59 | class Private; 60 | std::unique_ptr d; 61 | }; 62 | 63 | #endif // _PINLINEEDIT_H_ 64 | -------------------------------------------------------------------------------- /fltk/qualitypasswindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | qualitypasswindow.h - QualityPassWindow pin entry with Password QualityBar 3 | and etc 4 | 5 | Copyright (C) 2016 Anatoly madRat L. Berenblit 6 | 7 | Written by Anatoly madRat L. Berenblit . 8 | 9 | This program is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License as 11 | published by the Free Software Foundation; either version 2 of the 12 | License, or (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 | SPDX-License-Identifier: GPL-2.0+ 23 | */ 24 | 25 | #ifndef __QUALITYPASSWINDOW_H__ 26 | #define __QUALITYPASSWINDOW_H__ 27 | 28 | #include "passwindow.h" 29 | class Fl_Progress; 30 | 31 | class QualityPassWindow : public PassWindow 32 | { 33 | protected: 34 | static const char *QUALITY; 35 | 36 | public: 37 | typedef int (*GetQualityFn)(const char *passwd, void *ptr); 38 | 39 | static QualityPassWindow* create(GetQualityFn qualify, void* user); 40 | 41 | void quality(const char *name); 42 | 43 | protected: 44 | QualityPassWindow(GetQualityFn qualify, void*); 45 | 46 | const GetQualityFn get_quality_; 47 | void* const get_quality_user_; 48 | 49 | Fl_Progress *quality_; 50 | virtual int init(const int cx, const int cy); 51 | 52 | static void input_changed(Fl_Widget *input, void *val); 53 | }; 54 | 55 | #endif //#ifndef __QUALITYPASSWINDOW_H__ 56 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Program: Pinentry 2 | Homepage: https://gnupg.org/software/pinentry/ 3 | Download: https://gnupg.org/ftp/gcrypt/pinentry/ 4 | Repository: git://git.gnupg.org/pinentry.git 5 | Bug reports: https://bugs.gnupg.org 6 | Security related bug reports: 7 | License: GPLv2 8 | 9 | Pinentry is free software. See the files COPYING for copying conditions. 10 | License copyright years may be listed using range notation, e.g., 11 | 2000-2016, indicating that every year in the range, inclusive, is a 12 | copyrightable year that would otherwise be listed individually. 13 | 14 | List of Copyright holders 15 | ========================= 16 | 17 | Copyright (C) 1999 Robert Bihlmeyer 18 | Copyright (C) 2001-2004, 2007-2008, 2010, 2015-2017, 2021 g10 Code GmbH 19 | Copyright (C) 2002, 2008 Klarälvdalens Datakonsult AB (KDAB) 20 | Copyright (C) 2004 by Albrecht Dreß 21 | Copyright (C) 2007 Ingo Klöcker 22 | Copyright (C) 2014 Serge Voilokov 23 | Copyright (C) 2015 Daiki Ueno 24 | Copyright (C) 2015 Daniel Kahn Gillmor 25 | Copyright (C) 2016 Intevation GmbH 26 | Copyright (C) 2016 Anatoly madRat L. Berenblit 27 | 28 | 29 | Authors 30 | ------- 31 | 32 | Robert Bihlmeyer 33 | Werner Koch, g10 Code GmbH 34 | Steffen Hansen, Klarälvdalens Datakonsult AB 35 | 36 | Marcus Brinkmann, g10 Code GmbH 37 | Timo Schulz, g10 Code GmbH 38 | Neal Walfied, g10 Code GmbH 39 | Daniel Kahn Gillmor 40 | 41 | 42 | License 43 | ======== 44 | 45 | The optional TQt pinentry (found in the directory tqt/) is distributed 46 | under the GNU General Public License, version 2 (GPLv2only). All 47 | other parts of Pinentry are distributed under the GNU General Public 48 | License, version 2 or later (GPLv2+). See the file COPYING for details. 49 | -------------------------------------------------------------------------------- /tqt/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am 2 | # Copyright (C) 2002 g10 Code GmbH, Klarälvdalens Datakonsult AB 3 | # Copyright (C) 2008, 2015 g10 Code GmbH 4 | # 5 | # This file is part of PINENTRY. 6 | # 7 | # PINENTRY is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # PINENTRY is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program; if not, see . 19 | # SPDX-License-Identifier: GPL-2.0+ 20 | 21 | ## Process this file with automake to produce Makefile.in 22 | 23 | bin_PROGRAMS = pinentry-tqt 24 | 25 | 26 | if FALLBACK_CURSES 27 | ncurses_include = $(NCURSES_INCLUDE) 28 | libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV) 29 | else 30 | ncurses_include = 31 | libcurses = 32 | endif 33 | 34 | 35 | AM_CPPFLAGS = $(COMMON_CFLAGS) \ 36 | -I$(top_srcdir) -I$(top_srcdir)/secmem \ 37 | $(ncurses_include) -I$(top_srcdir)/pinentry 38 | AM_CXXFLAGS = $(PINENTRY_TQT_CFLAGS) 39 | pinentry_tqt_LDADD = \ 40 | ../pinentry/libpinentry.a $(top_builddir)/secmem/libsecmem.a \ 41 | $(COMMON_LIBS) $(PINENTRY_TQT_LIBS) $(libcurses) 42 | 43 | if BUILD_PINENTRY_TQT 44 | BUILT_SOURCES = \ 45 | secqlineedit.moc pinentrydialog.moc 46 | endif 47 | 48 | CLEANFILES = \ 49 | secqlineedit.moc pinentrydialog.moc 50 | 51 | pinentry_tqt_SOURCES = pinentrydialog.h pinentrydialog.cpp \ 52 | main.cpp secqinternal_p.h secqinternal.cpp \ 53 | secqlineedit.h secqlineedit.cpp \ 54 | secqstring.h secqstring.cpp 55 | 56 | nodist_pinentry_tqt_SOURCES = \ 57 | secqlineedit.moc pinentrydialog.moc 58 | 59 | .h.moc: 60 | $(TQT_MOC) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ 61 | -------------------------------------------------------------------------------- /w32/pinentry-w32.rc: -------------------------------------------------------------------------------- 1 | /* dialog.rc - Resource definitions -*- c -*- 2 | * Copyright (C) 2004, 2010 g10 Code GmbH 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License as 6 | * published by the Free Software Foundation; either version 2 of the 7 | * License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | * SPDX-License-Identifier: GPL-2.0+ 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include "resource.h" 23 | 24 | /* 25 | * Main dialog 26 | */ 27 | 28 | IDB_ICON_32 BITMAP DISCARDABLE "logo-32.bmp" 29 | IDB_ICON_48 BITMAP DISCARDABLE "logo-48.bmp" 30 | IDB_ICON_64 BITMAP DISCARDABLE "logo-64.bmp" 31 | IDB_ICON_96 BITMAP DISCARDABLE "logo-96.bmp" 32 | IDB_ICON_128 BITMAP DISCARDABLE "logo-128.bmp" 33 | 34 | IDD_PINENT DIALOG DISCARDABLE 0, 0, 230, 125 35 | STYLE DS_MODALFRAME | DS_SYSMODAL | WS_POPUP | WS_CAPTION | WS_SYSMENU 36 | CAPTION "Pinentry" 37 | FONT 10, "MS Sans Serif" 38 | BEGIN 39 | CONTROL "", IDC_PINENT_ICON, 40 | "Static", SS_BITMAP|SS_CENTERIMAGE, 41 | 5, 5, 32, 32 42 | LTEXT "", IDC_PINENT_DESC, 45, 5, 180, 65 43 | RTEXT "", IDC_PINENT_PROMPT, 5, 75, 60, 12 44 | EDITTEXT IDC_PINENT_TEXT, 70, 75, 155, 12, ES_PASSWORD | ES_AUTOHSCROLL 45 | CTEXT "", IDC_PINENT_ERR, 5, 90, 220, 12 46 | DEFPUSHBUTTON "O&K", IDOK, 50, 105, 85, 14 47 | PUSHBUTTON "&Cancel", IDCANCEL, 140, 105, 85, 14 48 | END 49 | -------------------------------------------------------------------------------- /qt/pinentryconfirm.h: -------------------------------------------------------------------------------- 1 | /* pinentryconfirm.h - A QMessageBox with a timeout 2 | * 3 | * Copyright (C) 2011 Ben Kibbey 4 | * Copyright (C) 2022 g10 Code GmbH 5 | * 6 | * Software engineering by Ingo Klöcker 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License as 10 | * published by the Free Software Foundation; either version 2 of the 11 | * License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, see . 20 | * SPDX-License-Identifier: GPL-2.0+ 21 | */ 22 | 23 | #ifndef PINENTRYCONFIRM_H 24 | #define PINENTRYCONFIRM_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class PinentryConfirm : public QMessageBox 31 | #ifndef QT_NO_ACCESSIBILITY 32 | , public QAccessible::ActivationObserver 33 | #endif 34 | { 35 | Q_OBJECT 36 | public: 37 | PinentryConfirm(Icon icon, const QString &title, const QString &text, 38 | StandardButtons buttons = NoButton, QWidget *parent = nullptr, 39 | Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 40 | ~PinentryConfirm() override; 41 | 42 | void setTimeout(std::chrono::seconds timeout); 43 | std::chrono::seconds timeout() const; 44 | 45 | bool timedOut() const; 46 | 47 | protected: 48 | void showEvent(QShowEvent *event) override; 49 | 50 | private Q_SLOTS: 51 | void slotTimeout(); 52 | 53 | private: 54 | #ifndef QT_NO_ACCESSIBILITY 55 | void accessibilityActiveChanged(bool active) override; 56 | #endif 57 | 58 | private: 59 | QTimer _timer; 60 | bool _timed_out = false; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /qt5/pinentryconfirm.h: -------------------------------------------------------------------------------- 1 | /* pinentryconfirm.h - A QMessageBox with a timeout 2 | * 3 | * Copyright (C) 2011 Ben Kibbey 4 | * Copyright (C) 2022 g10 Code GmbH 5 | * 6 | * Software engineering by Ingo Klöcker 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License as 10 | * published by the Free Software Foundation; either version 2 of the 11 | * License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, see . 20 | * SPDX-License-Identifier: GPL-2.0+ 21 | */ 22 | 23 | #ifndef PINENTRYCONFIRM_H 24 | #define PINENTRYCONFIRM_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class PinentryConfirm : public QMessageBox 31 | #ifndef QT_NO_ACCESSIBILITY 32 | , public QAccessible::ActivationObserver 33 | #endif 34 | { 35 | Q_OBJECT 36 | public: 37 | PinentryConfirm(Icon icon, const QString &title, const QString &text, 38 | StandardButtons buttons = NoButton, QWidget *parent = nullptr, 39 | Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 40 | ~PinentryConfirm() override; 41 | 42 | void setTimeout(std::chrono::seconds timeout); 43 | std::chrono::seconds timeout() const; 44 | 45 | bool timedOut() const; 46 | 47 | protected: 48 | void showEvent(QShowEvent *event) override; 49 | 50 | private Q_SLOTS: 51 | void slotTimeout(); 52 | 53 | private: 54 | #ifndef QT_NO_ACCESSIBILITY 55 | void accessibilityActiveChanged(bool active) override; 56 | #endif 57 | 58 | private: 59 | QTimer _timer; 60 | bool _timed_out = false; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /m4/qt4.m4: -------------------------------------------------------------------------------- 1 | dnl qt4.m4 2 | dnl Copyright (C) 2015 Intevation GmbH 3 | dnl 4 | dnl This file is part of PINENTRY. 5 | dnl 6 | dnl PINENTRY is free software; you can redistribute it and/or modify 7 | dnl it under the terms of the GNU General Public License as published by 8 | dnl the Free Software Foundation; either version 2 of the License, or 9 | dnl (at your option) any later version. 10 | dnl 11 | dnl PINENTRY is distributed in the hope that it will be useful, 12 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | dnl GNU General Public License for more details. 15 | dnl 16 | dnl You should have received a copy of the GNU General Public License 17 | dnl along with this program; if not, write to the Free Software 18 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | dnl Autoconf macro to find either Qt4 21 | dnl 22 | dnl sets PINENTRY_QT4_LIBS and PINENTRY_QT4_CFLAGS 23 | dnl 24 | dnl if Qt4 was found have_qt4_libs is set to yes 25 | dnl 26 | dnl The moc lookup code is based on libpoppler (rev. d821207) 27 | 28 | AC_DEFUN([FIND_QT4], 29 | [ 30 | have_qt4_libs="no"; 31 | 32 | if test "$enable_pinentry_qt4" != "no"; then 33 | PKG_CHECK_MODULES(PINENTRY_QT4, 34 | QtCore >= 4.6.0 QtGui >= 4.6.0, 35 | [have_qt4_libs="yes"], 36 | [have_qt4_libs="no"]) 37 | fi 38 | if test "$have_qt4_libs" = "yes"; then 39 | AC_CHECK_TOOL(MOC4, moc) 40 | AC_MSG_CHECKING([moc version]) 41 | mocversion=`$MOC4 -v 2>&1` 42 | mocversiongrep=`echo $mocversion | grep "Qt 4"` 43 | if test x"$mocversiongrep" != x"$mocversion"; then 44 | AC_MSG_RESULT([no]) 45 | # moc was not the qt4 one, try with moc-qt4 46 | AC_CHECK_TOOL(MOC42, moc-qt4) 47 | mocversion=`$MOC42 -v 2>&1` 48 | mocversiongrep=`echo $mocversion | grep "Qt 4"` 49 | if test x"$mocversiongrep" != x"$mocversion"; then 50 | # no valid moc found 51 | have_qt4_libs="no"; 52 | MOC4="not found" 53 | else 54 | MOC4=$MOC42 55 | fi 56 | fi 57 | fi 58 | ]) 59 | -------------------------------------------------------------------------------- /qt/capslock_unix.cpp: -------------------------------------------------------------------------------- 1 | /* capslock_unix.cpp - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021, 2024 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | #endif 24 | 25 | #include "capslock.h" 26 | #include "capslock_p.h" 27 | 28 | #include 29 | #include 30 | 31 | LockState capsLockState() 32 | { 33 | static bool reportUnsupportedPlatform = true; 34 | 35 | #if PINENTRY_KGUIADDONS 36 | if (qApp->platformName() != QLatin1String("wayland") && qApp->platformName() != QLatin1String("xcb") && reportUnsupportedPlatform) { 37 | #else 38 | if (reportUnsupportedPlatform) { 39 | #endif 40 | qWarning() << "Checking for Caps Lock not possible on unsupported platform:" << qApp->platformName(); 41 | } 42 | reportUnsupportedPlatform = false; 43 | #if PINENTRY_KGUIADDONS 44 | static KModifierKeyInfo keyInfo; 45 | return keyInfo.isKeyLocked(Qt::Key_CapsLock) ? LockState::On : LockState::Off; 46 | #endif 47 | return LockState::Unknown; 48 | } 49 | 50 | #if PINENTRY_KGUIADDONS 51 | void CapsLockWatcher::Private::watch() 52 | { 53 | keyInfo = new KModifierKeyInfo(); 54 | connect(keyInfo, &KModifierKeyInfo::keyLocked, q, [=](Qt::Key key, bool locked){ 55 | if (key == Qt::Key_CapsLock) { 56 | Q_EMIT q->stateChanged(locked); 57 | } 58 | }); 59 | } 60 | #endif 61 | -------------------------------------------------------------------------------- /qt4/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am 2 | # Copyright (C) 2002 g10 Code GmbH, Klarälvdalens Datakonsult AB 3 | # Copyright (C) 2008, 2015 g10 Code GmbH 4 | # 5 | # This file is part of PINENTRY. 6 | # 7 | # PINENTRY is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # PINENTRY is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program; if not, see . 19 | # SPDX-License-Identifier: GPL-2.0+ 20 | 21 | ## Process this file with automake to produce Makefile.in 22 | 23 | bin_PROGRAMS = pinentry-qt4 24 | 25 | EXTRA_DIST = document-encrypt.png pinentry.qrc 26 | 27 | 28 | if FALLBACK_CURSES 29 | ncurses_include = $(NCURSES_INCLUDE) 30 | libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV) 31 | else 32 | ncurses_include = 33 | libcurses = 34 | endif 35 | 36 | 37 | AM_CPPFLAGS = $(COMMON_CFLAGS) \ 38 | -I$(top_srcdir) -I$(top_srcdir)/secmem \ 39 | $(ncurses_include) -I$(top_srcdir)/pinentry 40 | AM_CXXFLAGS = $(PINENTRY_QT4_CFLAGS) 41 | pinentry_qt4_LDADD = \ 42 | ../pinentry/libpinentry.a $(top_builddir)/secmem/libsecmem.a \ 43 | $(COMMON_LIBS) $(PINENTRY_QT4_LIBS) $(libcurses) $(LIBCAP) 44 | pinentry_qt4_LDFLAGS = $(PINENTRY_QT4_LDFLAGS) 45 | 46 | if BUILD_PINENTRY_QT4 47 | BUILT_SOURCES = \ 48 | pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc 49 | endif 50 | 51 | CLEANFILES = \ 52 | pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc 53 | 54 | pinentry_qt4_SOURCES = pinentrydialog.h pinentrydialog.cpp \ 55 | main.cpp qrc_pinentry.cpp pinentryconfirm.cpp pinentryconfirm.h \ 56 | pinlineedit.h pinlineedit.cpp 57 | 58 | nodist_pinentry_qt4_SOURCES = \ 59 | pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc 60 | 61 | .h.moc: 62 | $(MOC4) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ 63 | -------------------------------------------------------------------------------- /docker/pinentry-qt4/Dockerfile: -------------------------------------------------------------------------------- 1 | # Dockerfile - docker/pinentry-qt4 2 | # Copyright (C) 2022 g10 Code GmbH 3 | # 4 | # Software engineering by Ingo Klöcker 5 | # 6 | # This file is part of GnuPG. 7 | # 8 | # Gpg4win is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # Gpg4win is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, see . 20 | # 21 | # SPDX-License-Identifier: GPL-2.0+ 22 | 23 | FROM centos:7 24 | 25 | # Import the CentOS 7 package signing key after verifying its fingerprint. 26 | # Then add the software collections repository from the CentOS SCLo SIG and 27 | # import its package signing key after verifying the fingerprint. 28 | # Ditto for the EPEL 7 package signing key. 29 | RUN test $(gpg --with-colons --with-fingerprint < /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 | grep ^pub: | wc -l) = 1 \ 30 | && gpg --with-colons --with-fingerprint < /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 | grep -q ^fpr:::::::::6341AB2753D78A78A7C27BB124C6A8A7F4A80EB5 \ 31 | && rpmkeys --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 \ 32 | && yum -y update \ 33 | && rm -rf /root/.gnupg 34 | 35 | RUN yum -y install \ 36 | automake \ 37 | binutils \ 38 | bzip2 \ 39 | gcc \ 40 | gcc-c++ \ 41 | libassuan-devel \ 42 | make \ 43 | qt-devel 44 | 45 | # pinentry requires libgpg-error-1.16 (CentOS 7 includes 1.12) 46 | RUN mkdir /tmp/libgpg-error \ 47 | && cd /tmp/libgpg-error \ 48 | && curl --remote-name https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.16.tar.gz \ 49 | && tar -xzf libgpg-error-1.16.tar.gz \ 50 | && cd libgpg-error-1.16 \ 51 | && ./configure \ 52 | && make install \ 53 | && cd \ 54 | && rm -rf /tmp/libgpg-error 55 | -------------------------------------------------------------------------------- /secmem/util.h: -------------------------------------------------------------------------------- 1 | /* Quintuple Agent utilities 2 | * Copyright (C) 1999 Robert Bihlmeyer 3 | * Copyright (C) 2003 g10 Code GmbH 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see . 17 | * SPDX-License-Identifier: GPL-2.0+ 18 | */ 19 | 20 | #ifndef _UTIL_H 21 | #define _UTIL_H 22 | 23 | #include 24 | 25 | #ifndef HAVE_TYPE_BYTE 26 | # undef byte 27 | # if !(defined(_WIN32) && defined(cbNDRContext)) 28 | /* Windows typedefs byte in the rpc headers. Avoid warning about 29 | double definition. */ 30 | typedef unsigned char byte; 31 | # endif 32 | # define HAVE_TYPE_BYTE 33 | #endif 34 | 35 | #ifndef HAVE_TYPE_ULONG 36 | # undef ulong 37 | typedef unsigned long ulong; 38 | # define HAVE_TYPE_ULONG 39 | #endif 40 | 41 | 42 | ssize_t xwrite(int, const void *, size_t); /* write until finished */ 43 | int debugmsg(const char *, ...); /* output a debug message if debugging==on */ 44 | void drop_privs(void); /* finally drop privileges */ 45 | 46 | 47 | /* To avoid that a compiler optimizes certain memset calls away, these 48 | macros may be used instead. */ 49 | #define wipememory2(_ptr,_set,_len) do { \ 50 | volatile char *_vptr=(volatile char *)(_ptr); \ 51 | size_t _vlen=(_len); \ 52 | while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \ 53 | } while(0) 54 | #define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) 55 | #define wipe(_ptr,_len) wipememory2(_ptr,0,_len) 56 | 57 | 58 | 59 | 60 | #define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \ 61 | *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10)) 62 | #define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1)) 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /README.GIT: -------------------------------------------------------------------------------- 1 | If you are building from GIT, run the script 2 | 3 | ./autogen.sh 4 | 5 | first, to make sure that you have all the necessary maintainer tools 6 | are installed and to build the actual configuration files. If you 7 | have just checked out from GIT, you should add the option "--force" to 8 | autogen.sh so that meta data is noticed by autom4te.cache. Then run 9 | 10 | ./configure --enable-maintainer-mode 11 | 12 | followed by the usual make. 13 | 14 | If autogen.sh complains about insufficient versions of the required 15 | tools, or the tools are not installed, you may use environment 16 | variables to override the default tool names: 17 | 18 | AUTOMAKE_SUFFIX is used as a suffix for all tools from the automake 19 | package. For example 20 | AUTOMAKE_SUFFIX="-1.7" ./autogen.sh 21 | uses "automake-1.7" and "aclocal-1.7. 22 | AUTOMAKE_PREFIX is used as a prefix for all tools from the automake 23 | page and may be combined with AUTOMAKE_SUFFIX. e.g.: 24 | AUTOMAKE_PREFIX=/usr/foo/bin ./autogen.sh 25 | uses "automake" and "aclocal" in the /usr/foo/bin 26 | directory. 27 | AUTOCONF_SUFFIX is used as a suffix for all tools from the automake 28 | package 29 | AUTOCONF_PREFIX is used as a prefix for all tools from the automake 30 | package 31 | GETTEXT_SUFFIX is used as a suffix for all tools from the gettext 32 | package 33 | GETTEXT_PREFIX is used as a prefix for all tools from the gettext 34 | package 35 | 36 | It is also possible to use the variable name AUTOMAKE, AUTOCONF, 37 | ACLOCAL, AUTOHEADER, GETTEXT and MSGMERGE to directly specify the name 38 | of the programs to run. It is however better to use the suffix and 39 | prefix forms as described above because that does not require 40 | knowledge about the actual tools used by autogen.sh. 41 | 42 | 43 | Please don't use autopoint, libtoolize or autoreconf unless you are 44 | the current maintainer and want to update the standard configuration 45 | files. All those files should be in GIT and only updated manually 46 | if the maintainer decides that newer versions are required. The 47 | maintainer should also make sure that the required version of automake 48 | et al. are properly indicated at the top of configure.ac and take care 49 | to copy the files and not merely use symlinks. 50 | -------------------------------------------------------------------------------- /fltk/encrypt.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * const encrypt_xpm[] = { 3 | /* columns rows colors chars-per-pixel */ 4 | "32 45 32 1 ", 5 | " c #9B7738", 6 | ". c #B08830", 7 | "X c #CA9703", 8 | "o c #C99607", 9 | "O c #CD9A02", 10 | "+ c #D19D03", 11 | "@ c #D4A002", 12 | "# c #D7A305", 13 | "$ c #D8A501", 14 | "% c #DFAB01", 15 | "& c #DCA803", 16 | "* c #E3B103", 17 | "= c #E7B702", 18 | "- c #C39A31", 19 | "; c #D4AC2F", 20 | ": c #E6BE26", 21 | "> c #EFC002", 22 | ", c #F5CD06", 23 | "< c #FEE21D", 24 | "1 c #FCE01F", 25 | "2 c #F6D424", 26 | "3 c #B49A55", 27 | "4 c #CAAC5F", 28 | "5 c #FCE854", 29 | "6 c #888887", 30 | "7 c #9A9A9A", 31 | "8 c #A7A7A7", 32 | "9 c #B8B8B7", 33 | "0 c #F3F08F", 34 | "q c #C3C3C3", 35 | "w c gray85", 36 | "e c None", 37 | /* pixels */ 38 | "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", 39 | "eeeeeeeeeee889qqqq987eeeeeeeeeee", 40 | "eeeeeeeee89qwwwqqwwww88eeeeeeeee", 41 | "eeeeeeee99qq877777669wq8eeeeeeee", 42 | "eeeeeee99q888888888876ww9eeeeeee", 43 | "eeeeee99q888888887778869q9eeeeee", 44 | "eeeee89q8888eeeeeeee7786wq8eeeee", 45 | "eeeee999888eeeeeeeeee7777wqeeeee", 46 | "eeee899778eeeeeeeeeeee776wq8eeee", 47 | "eeee8q977eeeeeeeeeeeeee779q9eeee", 48 | "eeee8q977eeeeeeeeeeeeee777w9eeee", 49 | "eeee8q867eeeeeeeeeeeeee776wqeeee", 50 | "eeee8q768eeeeeeeeeeeeee766wqeeee", 51 | "eeee8q768eeeeeeeeeeeeee766wqeeee", 52 | "eeee8q778eeeeeeeeeeeeee776wqeeee", 53 | "eeee8q778eeeeeeeeeeeeee776wqeeee", 54 | "eeee8q888eeeeeeeeeeeeee786wqeeee", 55 | "eeee8q888eeeeeeeeeeeeee786wqeeee", 56 | "eeee8q898eeeeeeeeeeeeee796wqeeee", 57 | "eeee8q898eeeeeeeeeeeeee896wqeeee", 58 | "e45444443333 3333444003e", 59 | "e4552::;;--... ...--;;:25003e", 60 | "e4552,>>=&@OXXooXO+@$&*=>,15003e", 61 | "e4552,>>*&#+ooooo++##&*=>,15003e", 62 | "e4552,>>*&#+XXXXXO+@#&*=>,<5003e", 63 | "e4552,>>=%$+OXXOO++##&*=>,15003e", 64 | "e4552,>>=%$OooXXO+@@#&%=,,<5003e", 65 | "e4552,>>=%$@OXXO+@@#&&*=>,15003e", 66 | "e4552,>>*&$+XXXXOO++@#%=>,<5003e", 67 | "e4552,>>=&$+OXXO++@@$&*=,,<5003e", 68 | "e4552,>>=%$+XXXXOO+@#&*=>,<5003e", 69 | "e4552,>>*&#+ooXO++@##&*>,,<5003e", 70 | "e4552,>>=%$@OXXO++@$$%*>,,<5003e", 71 | "e4552,>>=%$+OXXO++@#$&*=,,<5003e", 72 | "e4552,>>=%$@OOOO++@$&%*=>,<5003e", 73 | "e4552,>>=%$+OXXOO+@#&%=>,,<5003e", 74 | "e4552,>>=%$+OXXOO+@##%*=>,<5003e", 75 | "e4552,>>*&#+oooO++@#&&*>,,<5003e", 76 | "e4552,>>=%$@OOOO+@$&%%*>,,<5003e", 77 | "e4552,>>=%$@OOXO+@$&%%*>,,<5003e", 78 | "e4552,>>=%$+OXXO+@$&&%*>,,<5003e", 79 | "e4552,>>=%$@OOO+@@$&%%=>,,<5003e", 80 | "e4552,>>=%$@OOO+@@$&%%=>,,<5003e", 81 | "e4552,>>=%$@OOO+@@$&%%=>,,<5003e", 82 | "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" 83 | }; 84 | -------------------------------------------------------------------------------- /qt/focusframe.cpp: -------------------------------------------------------------------------------- 1 | /* focusframe.cpp - A focus indicator for labels. 2 | * Copyright (C) 2022 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #include "focusframe.h" 22 | 23 | #if QT_CONFIG(graphicseffect) 24 | #include 25 | #endif 26 | #include 27 | #include 28 | 29 | static QRect effectiveWidgetRect(const QWidget *w) 30 | { 31 | // based on QWidgetPrivate::effectiveRectFor 32 | #if QT_CONFIG(graphicseffect) 33 | const auto* const graphicsEffect = w->graphicsEffect(); 34 | if (graphicsEffect && graphicsEffect->isEnabled()) 35 | return graphicsEffect->boundingRectFor(w->rect()).toAlignedRect(); 36 | #endif // QT_CONFIG(graphicseffect) 37 | return w->rect(); 38 | } 39 | 40 | static QRect clipRect(const QWidget *w) 41 | { 42 | // based on QWidgetPrivate::clipRect 43 | if (!w->isVisible()) { 44 | return QRect(); 45 | } 46 | QRect r = effectiveWidgetRect(w); 47 | int ox = 0; 48 | int oy = 0; 49 | while (w && w->isVisible() && !w->isWindow() && w->parentWidget()) { 50 | ox -= w->x(); 51 | oy -= w->y(); 52 | w = w->parentWidget(); 53 | r &= QRect(ox, oy, w->width(), w->height()); 54 | } 55 | return r; 56 | } 57 | 58 | void FocusFrame::paintEvent(QPaintEvent *) 59 | { 60 | if (!widget()) { 61 | return; 62 | } 63 | 64 | QStylePainter p{this}; 65 | QStyleOptionFocusRect option; 66 | initStyleOption(&option); 67 | const int vmargin = style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &option); 68 | const int hmargin = style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &option); 69 | const QRect rect = clipRect(widget()).adjusted(0, 0, hmargin*2, vmargin*2); 70 | p.setClipRect(rect); 71 | p.drawPrimitive(QStyle::PE_FrameFocusRect, option); 72 | } 73 | 74 | #include "focusframe.moc" 75 | -------------------------------------------------------------------------------- /qt5/focusframe.cpp: -------------------------------------------------------------------------------- 1 | /* focusframe.cpp - A focus indicator for labels. 2 | * Copyright (C) 2022 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #include "focusframe.h" 22 | 23 | #if QT_CONFIG(graphicseffect) 24 | #include 25 | #endif 26 | #include 27 | #include 28 | 29 | static QRect effectiveWidgetRect(const QWidget *w) 30 | { 31 | // based on QWidgetPrivate::effectiveRectFor 32 | #if QT_CONFIG(graphicseffect) 33 | const auto* const graphicsEffect = w->graphicsEffect(); 34 | if (graphicsEffect && graphicsEffect->isEnabled()) 35 | return graphicsEffect->boundingRectFor(w->rect()).toAlignedRect(); 36 | #endif // QT_CONFIG(graphicseffect) 37 | return w->rect(); 38 | } 39 | 40 | static QRect clipRect(const QWidget *w) 41 | { 42 | // based on QWidgetPrivate::clipRect 43 | if (!w->isVisible()) { 44 | return QRect(); 45 | } 46 | QRect r = effectiveWidgetRect(w); 47 | int ox = 0; 48 | int oy = 0; 49 | while (w && w->isVisible() && !w->isWindow() && w->parentWidget()) { 50 | ox -= w->x(); 51 | oy -= w->y(); 52 | w = w->parentWidget(); 53 | r &= QRect(ox, oy, w->width(), w->height()); 54 | } 55 | return r; 56 | } 57 | 58 | void FocusFrame::paintEvent(QPaintEvent *) 59 | { 60 | if (!widget()) { 61 | return; 62 | } 63 | 64 | QStylePainter p{this}; 65 | QStyleOptionFocusRect option; 66 | initStyleOption(&option); 67 | const int vmargin = style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &option); 68 | const int hmargin = style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &option); 69 | const QRect rect = clipRect(widget()).adjusted(0, 0, hmargin*2, vmargin*2); 70 | p.setClipRect(rect); 71 | p.drawPrimitive(QStyle::PE_FrameFocusRect, option); 72 | } 73 | 74 | #include "focusframe.moc" 75 | -------------------------------------------------------------------------------- /qt4/pinentryconfirm.cpp: -------------------------------------------------------------------------------- 1 | /* pinentryconfirm.cpp - A QMessageBox with a timeout 2 | * 3 | * Copyright (C) 2011 Ben Kibbey 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see . 17 | * SPDX-License-Identifier: GPL-2.0+ 18 | */ 19 | 20 | #include "pinentryconfirm.h" 21 | #include "pinentrydialog.h" 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | PinentryConfirm::PinentryConfirm(Icon icon, int timeout, const QString &title, 28 | const QString &desc, StandardButtons buttons, QWidget *parent) : 29 | QMessageBox(icon, title, desc, buttons, parent) 30 | { 31 | _timed_out = false; 32 | if (timeout > 0) { 33 | _timer = new QTimer(this); 34 | connect(_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); 35 | _timer->start(timeout * 1000); 36 | } 37 | #ifndef QT_NO_ACCESSIBILITY 38 | setAccessibleDescription(desc); 39 | setAccessibleName(title); 40 | #endif 41 | raiseWindow(this); 42 | } 43 | 44 | bool PinentryConfirm::timedOut() const 45 | { 46 | return _timed_out; 47 | } 48 | 49 | void PinentryConfirm::showEvent(QShowEvent *event) 50 | { 51 | static bool resized; 52 | if (!resized) { 53 | QGridLayout* lay = dynamic_cast (layout()); 54 | if (lay) { 55 | QSize textSize = fontMetrics().size(Qt::TextExpandTabs, text(), fontMetrics().maxWidth()); 56 | QSpacerItem* horizontalSpacer = new QSpacerItem(textSize.width() + iconPixmap().width(), 57 | 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 58 | lay->addItem(horizontalSpacer, lay->rowCount(), 1, 1, lay->columnCount() - 1); 59 | } 60 | resized = true; 61 | } 62 | 63 | QDialog::showEvent(event); 64 | raiseWindow(this); 65 | } 66 | 67 | void PinentryConfirm::slotTimeout() 68 | { 69 | QAbstractButton *b = button(QMessageBox::Cancel); 70 | _timed_out = true; 71 | 72 | if (b) { 73 | b->animateClick(0); 74 | } 75 | } 76 | 77 | #include "pinentryconfirm.moc" 78 | -------------------------------------------------------------------------------- /qt/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am 2 | # Copyright (C) 2002 g10 Code GmbH, Klarälvdalens Datakonsult AB 3 | # Copyright (C) 2008, 2015 g10 Code GmbH 4 | # 5 | # This file is part of PINENTRY. 6 | # 7 | # PINENTRY is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # PINENTRY is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program; if not, see . 19 | # SPDX-License-Identifier: GPL-2.0+ 20 | 21 | ## Process this file with automake to produce Makefile.in 22 | 23 | bin_PROGRAMS = pinentry-qt 24 | 25 | EXTRA_DIST = pinentryrc.qrc 26 | 27 | SUBDIRS = icons 28 | 29 | 30 | if FALLBACK_CURSES 31 | ncurses_include = $(NCURSES_INCLUDE) 32 | libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV) 33 | else 34 | ncurses_include = 35 | libcurses = 36 | endif 37 | 38 | 39 | AM_CPPFLAGS = $(COMMON_CFLAGS) \ 40 | -I$(top_srcdir) -I$(top_srcdir)/secmem \ 41 | $(ncurses_include) -I$(top_srcdir)/pinentry 42 | AM_CXXFLAGS = $(PINENTRY_QT6_CFLAGS) 43 | pinentry_qt_LDADD = \ 44 | ../pinentry/libpinentry.a $(top_builddir)/secmem/libsecmem.a \ 45 | $(COMMON_LIBS) $(PINENTRY_QT6_LIBS) $(libcurses) 46 | pinentry_qt_LDFLAGS = $(PINENTRY_QT6_LDFLAGS) 47 | 48 | if BUILD_PINENTRY_QT6 49 | BUILT_SOURCES = \ 50 | pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc capslock.moc \ 51 | focusframe.moc \ 52 | keyboardfocusindication.moc \ 53 | pinentryrc.cpp 54 | endif 55 | 56 | CLEANFILES = $(BUILT_SOURCES) 57 | 58 | if HAVE_W32_SYSTEM 59 | pinentry_qt_platform_SOURCES = capslock_win.cpp 60 | else 61 | pinentry_qt_platform_SOURCES = capslock_unix.cpp 62 | endif 63 | 64 | pinentry_qt_SOURCES = pinentrydialog.h pinentrydialog.cpp \ 65 | main.cpp pinentryconfirm.cpp pinentryconfirm.h \ 66 | pinlineedit.h pinlineedit.cpp capslock.cpp capslock.h capslock_p.h \ 67 | pinentry_debug.cpp pinentry_debug.h util.h accessibility.cpp \ 68 | accessibility.h qti18n.cpp pinentryrc.qrc \ 69 | focusframe.h focusframe.cpp \ 70 | keyboardfocusindication.h keyboardfocusindication.cpp \ 71 | $(pinentry_qt_platform_SOURCES) 72 | 73 | nodist_pinentry_qt_SOURCES = $(BUILT_SOURCES) 74 | 75 | .h.moc: 76 | $(MOC6) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ 77 | 78 | pinentryrc.cpp: pinentryrc.qrc 79 | $(RCC6) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ 80 | 81 | desktopdir = $(datadir)/applications 82 | desktop_DATA = org.gnupg.pinentry-qt.desktop 83 | -------------------------------------------------------------------------------- /qt5/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am 2 | # Copyright (C) 2002 g10 Code GmbH, Klarälvdalens Datakonsult AB 3 | # Copyright (C) 2008, 2015 g10 Code GmbH 4 | # 5 | # This file is part of PINENTRY. 6 | # 7 | # PINENTRY is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # PINENTRY is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program; if not, see . 19 | # SPDX-License-Identifier: GPL-2.0+ 20 | 21 | ## Process this file with automake to produce Makefile.in 22 | 23 | bin_PROGRAMS = pinentry-qt5 24 | 25 | EXTRA_DIST = pinentryrc.qrc 26 | 27 | SUBDIRS = icons 28 | 29 | 30 | if FALLBACK_CURSES 31 | ncurses_include = $(NCURSES_INCLUDE) 32 | libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV) 33 | else 34 | ncurses_include = 35 | libcurses = 36 | endif 37 | 38 | 39 | AM_CPPFLAGS = $(COMMON_CFLAGS) \ 40 | -I$(top_srcdir) -I$(top_srcdir)/secmem \ 41 | $(ncurses_include) -I$(top_srcdir)/pinentry 42 | AM_CXXFLAGS = $(PINENTRY_QT5_CFLAGS) 43 | pinentry_qt5_LDADD = \ 44 | ../pinentry/libpinentry.a $(top_builddir)/secmem/libsecmem.a \ 45 | $(COMMON_LIBS) $(PINENTRY_QT5_LIBS) $(libcurses) 46 | pinentry_qt5_LDFLAGS = $(PINENTRY_QT5_LDFLAGS) 47 | 48 | if BUILD_PINENTRY_QT5 49 | BUILT_SOURCES = \ 50 | pinentryconfirm.moc pinentrydialog.moc pinlineedit.moc capslock.moc \ 51 | focusframe.moc \ 52 | keyboardfocusindication.moc \ 53 | pinentryrc.cpp 54 | endif 55 | 56 | CLEANFILES = $(BUILT_SOURCES) 57 | 58 | if HAVE_W32_SYSTEM 59 | pinentry_qt5_platform_SOURCES = capslock_win.cpp 60 | else 61 | pinentry_qt5_platform_SOURCES = capslock_unix.cpp 62 | endif 63 | 64 | pinentry_qt5_SOURCES = pinentrydialog.h pinentrydialog.cpp \ 65 | main.cpp pinentryconfirm.cpp pinentryconfirm.h \ 66 | pinlineedit.h pinlineedit.cpp capslock.cpp capslock.h capslock_p.h \ 67 | pinentry_debug.cpp pinentry_debug.h util.h accessibility.cpp \ 68 | accessibility.h qti18n.cpp pinentryrc.qrc \ 69 | focusframe.h focusframe.cpp \ 70 | keyboardfocusindication.h keyboardfocusindication.cpp \ 71 | $(pinentry_qt5_platform_SOURCES) 72 | 73 | nodist_pinentry_qt5_SOURCES = $(BUILT_SOURCES) 74 | 75 | .h.moc: 76 | $(MOC5) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ 77 | 78 | pinentryrc.cpp: pinentryrc.qrc 79 | $(RCC5) `test -f '$<' || echo '$(srcdir)/'`$< -o $@ 80 | 81 | desktopdir = $(datadir)/applications 82 | desktop_DATA = org.gnupg.pinentry-qt5.desktop 83 | -------------------------------------------------------------------------------- /fltk/passwindow.cxx: -------------------------------------------------------------------------------- 1 | /* 2 | passwindow.cxx - PassWindow is a more complex fltk dialog with more longer 3 | desc field and possibility to show some error text. 4 | if needed qualitybar - should be used QualityPassWindow. 5 | 6 | Copyright (C) 2016 Anatoly madRat L. Berenblit 7 | 8 | Written by Anatoly madRat L. Berenblit . 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License as 12 | published by the Free Software Foundation; either version 2 of the 13 | License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | SPDX-License-Identifier: GPL-2.0+ 24 | */ 25 | 26 | #include "passwindow.h" 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | const char *PassWindow::DESCRIPTION = "Please enter the passphrase:"; 33 | 34 | PassWindow::PassWindow() : error_(NULL) 35 | { 36 | } 37 | 38 | void PassWindow::prompt(const char *name) 39 | { 40 | set_label(input_, name, PROMPT); 41 | } 42 | 43 | void PassWindow::description(const char *name) 44 | { 45 | set_label(message_, name, DESCRIPTION); 46 | } 47 | 48 | void PassWindow::error(const char *name) 49 | { 50 | set_label(error_, name, ""); 51 | } 52 | 53 | int PassWindow::init(const int cx, const int cy) 54 | { 55 | int y = PinWindow::init(cx, cy); 56 | 57 | assert(window_ == Fl_Group::current()); // make_window should all add current 58 | 59 | y = icon_->y(); // move back to icon's 60 | 61 | const int mx = icon_->x()+icon_->w(); 62 | message_->resize(mx, icon_->y(), cx-mx-10, icon_->h()); 63 | message_->align(Fl_Align(FL_ALIGN_LEFT | FL_ALIGN_CLIP | FL_ALIGN_WRAP | FL_ALIGN_INSIDE)); 64 | description(NULL); 65 | y += icon_->h(); 66 | 67 | input_->resize(130, y+5, cx-150, 25); 68 | input_->labeltype(FL_NORMAL_LABEL); 69 | prompt(NULL); 70 | y = input_->y()+input_->h(); 71 | 72 | error_ = new Fl_Box(20, y+5, cx-30, 30); 73 | error_->labelcolor(FL_RED); 74 | error_->align(Fl_Align(FL_ALIGN_CENTER | FL_ALIGN_WRAP | FL_ALIGN_INSIDE)); // if not fit - user can read 75 | y = error_->y()+error_->h(); 76 | return y; 77 | } 78 | 79 | PassWindow* PassWindow::create() 80 | { 81 | PassWindow* p = new PassWindow; 82 | p->init(460, 185); 83 | p->window_->end(); 84 | p->input_->take_focus(); 85 | return p; 86 | } 87 | -------------------------------------------------------------------------------- /secmem/util.c: -------------------------------------------------------------------------------- 1 | /* Quintuple Agent 2 | * Copyright (C) 1999 Robert Bihlmeyer 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | * SPDX-License-Identifier: GPL-2.0+ 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #define _GNU_SOURCE 1 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "util.h" 34 | 35 | #ifndef HAVE_DOSISH_SYSTEM 36 | static int uid_set = 0; 37 | static uid_t real_uid, file_uid; 38 | #endif /*!HAVE_DOSISH_SYSTEM*/ 39 | 40 | /* Write DATA of size BYTES to FD, until all is written or an error 41 | occurs. */ 42 | ssize_t 43 | xwrite(int fd, const void *data, size_t bytes) 44 | { 45 | char *ptr; 46 | size_t todo; 47 | ssize_t written = 0; 48 | 49 | for (ptr = (char *)data, todo = bytes; todo; ptr += written, todo -= written) 50 | { 51 | do 52 | written = write (fd, ptr, todo); 53 | while ( 54 | written == -1 && errno == EINTR 55 | ); 56 | if (written < 0) 57 | break; 58 | } 59 | return written; 60 | } 61 | 62 | #if 0 63 | extern int debug; 64 | 65 | int 66 | debugmsg(const char *fmt, ...) 67 | { 68 | va_list va; 69 | int ret; 70 | 71 | if (debug) { 72 | va_start(va, fmt); 73 | fprintf(stderr, "\e[4m"); 74 | ret = vfprintf(stderr, fmt, va); 75 | fprintf(stderr, "\e[24m"); 76 | va_end(va); 77 | return ret; 78 | } else 79 | return 0; 80 | } 81 | #endif 82 | 83 | /* initialize uid variables */ 84 | #ifndef HAVE_DOSISH_SYSTEM 85 | static void 86 | init_uids(void) 87 | { 88 | real_uid = getuid(); 89 | file_uid = geteuid(); 90 | uid_set = 1; 91 | } 92 | #endif 93 | 94 | 95 | /* drop all additional privileges */ 96 | void 97 | drop_privs(void) 98 | { 99 | #ifndef HAVE_DOSISH_SYSTEM 100 | if (!uid_set) 101 | init_uids(); 102 | if (real_uid != file_uid) { 103 | if (setuid(real_uid) < 0) { 104 | perror("dropping privileges failed"); 105 | exit(EXIT_FAILURE); 106 | } 107 | file_uid = real_uid; 108 | } 109 | #endif 110 | } 111 | -------------------------------------------------------------------------------- /secmem/secmem++.h: -------------------------------------------------------------------------------- 1 | /* STL allocator for secmem 2 | * Copyright (C) 2008 Marc Mutz 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see . 16 | * SPDX-License-Identifier: GPL-2.0+ 17 | */ 18 | 19 | #ifndef __SECMEM_SECMEMPP_H__ 20 | #define __SECMEM_SECMEMPP_H__ 21 | 22 | #include "../secmem/secmem.h" 23 | #include 24 | 25 | namespace secmem { 26 | 27 | template 28 | class alloc { 29 | public: 30 | // type definitions: 31 | typedef size_t size_type; 32 | typedef ptrdiff_t difference_type; 33 | typedef T* pointer; 34 | typedef const T* const_pointer; 35 | typedef T& reference; 36 | typedef const T& const_reference; 37 | typedef T value_type; 38 | 39 | // rebind 40 | template 41 | struct rebind { 42 | typedef alloc other; 43 | }; 44 | 45 | // address 46 | pointer address( reference value ) const { 47 | return &value; 48 | } 49 | const_pointer address( const_reference value ) const { 50 | return &value; 51 | } 52 | 53 | // (trivial) ctors and dtors 54 | alloc() {} 55 | alloc( const alloc & ) {} 56 | template alloc( const alloc & ) {} 57 | // copy ctor is ok 58 | ~alloc() {} 59 | 60 | // de/allocation 61 | size_type max_size() const { 62 | return secmem_get_max_size(); 63 | } 64 | 65 | pointer allocate( size_type n, void * =0 ) { 66 | return static_cast( secmem_malloc( n * sizeof(T) ) ); 67 | } 68 | 69 | void deallocate( pointer p, size_type ) { 70 | secmem_free( p ); 71 | } 72 | 73 | // de/construct 74 | void construct( pointer p, const T & value ) { 75 | void * loc = p; 76 | new (loc)T(value); 77 | } 78 | void destruct( pointer p ) { 79 | p->~T(); 80 | } 81 | }; 82 | 83 | // equality comparison 84 | template 85 | bool operator==( const alloc &, const alloc & ) { return true; } 86 | template 87 | bool operator!=( const alloc &, const alloc & ) { return false; } 88 | 89 | } 90 | 91 | #endif /* __SECMEM_SECMEMPP_H__ */ 92 | -------------------------------------------------------------------------------- /tqt/pinentrydialog.h: -------------------------------------------------------------------------------- 1 | /* pinentrydialog.h - A secure KDE dialog for PIN entry. 2 | * Copyright (C) 2002 Klarälvdalens Datakonsult AB 3 | * Written by Steffen Hansen . 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see . 17 | * SPDX-License-Identifier: GPL-2.0+ 18 | */ 19 | 20 | #ifndef __PINENTRYDIALOG_H__ 21 | #define __PINENTRYDIALOG_H__ 22 | 23 | #include 24 | #include "pinentry.h" 25 | 26 | class TQLabel; 27 | class TQPushButton; 28 | class TQProgressBar; 29 | class SecTQLineEdit; 30 | class SecTQString; 31 | 32 | class PinEntryDialog : public TQDialog { 33 | TQ_OBJECT 34 | 35 | TQ_PROPERTY( TQString description READ description WRITE setDescription ) 36 | TQ_PROPERTY( TQString error READ error WRITE setError ) 37 | // TQ_PROPERTY( SecTQString text READ text WRITE setText ) 38 | TQ_PROPERTY( TQString prompt READ prompt WRITE setPrompt ) 39 | public: 40 | friend class PinEntryController; // TODO: remove when assuan lets me use TQt eventloop. 41 | PinEntryDialog( TQWidget* parent = 0, const char* name = 0, 42 | bool modal = false, bool enable_quality_bar = false ); 43 | 44 | void setDescription( const TQString& ); 45 | TQString description() const; 46 | 47 | void setError( const TQString& ); 48 | TQString error() const; 49 | 50 | void setText( const SecTQString& ); 51 | SecTQString text() const; 52 | 53 | void setPrompt( const TQString& ); 54 | TQString prompt() const; 55 | 56 | void setOkText( const TQString& ); 57 | void setCancelText( const TQString& ); 58 | 59 | void setQualityBar( const TQString& ); 60 | void setQualityBarTT( const TQString& ); 61 | 62 | void setPinentryInfo (pinentry_t); 63 | 64 | public slots: 65 | void updateQuality(const SecTQString &); 66 | void onBackspace(); 67 | 68 | signals: 69 | void accepted(); 70 | void rejected(); 71 | 72 | protected: 73 | virtual void keyPressEvent( TQKeyEvent *e ); 74 | virtual void hideEvent( TQHideEvent* ); 75 | virtual void paintEvent( TQPaintEvent* ); 76 | 77 | private: 78 | TQLabel* _icon; 79 | TQLabel* _desc; 80 | TQLabel* _error; 81 | TQLabel* _prompt; 82 | TQLabel* _quality_bar_label; 83 | TQProgressBar* _quality_bar; 84 | SecTQLineEdit* _edit; 85 | TQPushButton* _ok; 86 | TQPushButton* _cancel; 87 | bool _grabbed; 88 | bool _have_quality_bar; 89 | pinentry_t _pinentry_info; 90 | bool _disable_echo_allowed; 91 | }; 92 | 93 | 94 | #endif // __PINENTRYDIALOG_H__ 95 | -------------------------------------------------------------------------------- /fltk/qualitypasswindow.cxx: -------------------------------------------------------------------------------- 1 | /* 2 | qualitypasswindow.cxx - QualityPassWindow pin entry 3 | with Password QualityBar and etc 4 | 5 | Copyright (C) 2016 Anatoly madRat L. Berenblit 6 | 7 | Written by Anatoly madRat L. Berenblit . 8 | 9 | This program is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU General Public License as 11 | published by the Free Software Foundation; either version 2 of the 12 | License, or (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to the Free Software 21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22 | SPDX-License-Identifier: GPL-2.0+ 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "qualitypasswindow.h" 31 | 32 | const char *QualityPassWindow::QUALITY = "Quality"; 33 | 34 | QualityPassWindow::QualityPassWindow(QualityPassWindow::GetQualityFn qualify, void* ptr) 35 | : get_quality_(qualify) 36 | ,get_quality_user_(ptr) 37 | ,quality_(NULL) 38 | { 39 | assert(NULL != qualify); 40 | } 41 | 42 | void QualityPassWindow::input_changed(Fl_Widget *input, void *val) 43 | { 44 | QualityPassWindow *self = reinterpret_cast(val); 45 | 46 | assert(NULL != self->get_quality_); // function should be assigned in ctor 47 | assert(NULL != self->quality_); // quality progress bar must be created in init 48 | 49 | if (NULL != self->quality_ && NULL != self->get_quality_) 50 | { 51 | int result = self->get_quality_(self->input_->value(), self->get_quality_user_); 52 | bool isErr = (result <= 0); 53 | if (isErr) 54 | result = -result; 55 | self->quality_->selection_color(isErr?FL_RED:FL_GREEN); 56 | self->quality_->value(std::min(result, 100)); 57 | } 58 | } 59 | 60 | QualityPassWindow* QualityPassWindow::create(QualityPassWindow::GetQualityFn qualify, void *user) 61 | { 62 | QualityPassWindow *p = new QualityPassWindow(qualify, user); 63 | p->init(460, 215); 64 | p->window_->end(); 65 | p->input_->take_focus(); 66 | return p; 67 | } 68 | 69 | void QualityPassWindow::quality(const char *name) 70 | { 71 | set_label(quality_, name, QUALITY); 72 | } 73 | 74 | int QualityPassWindow::init(const int cx, const int cy) 75 | { 76 | int y = PassWindow::init(cx, cy); 77 | assert(window_ == Fl_Group::current()); // make_window should all add current 78 | 79 | input_->when(FL_WHEN_CHANGED); 80 | input_->callback(input_changed, this); 81 | 82 | y = input_->y() + input_->h(); 83 | 84 | quality_ = new Fl_Progress(input_->x(), y+5, input_->w(), 25, QUALITY); 85 | quality_->align(Fl_Align(FL_ALIGN_LEFT | FL_ALIGN_CLIP | FL_ALIGN_WRAP)); 86 | quality_->maximum(100.1); 87 | quality_->minimum(0.0); 88 | y = quality_->y() + quality_->h(); 89 | 90 | error_->position(error_->x(), y+5); 91 | 92 | return error_->y() + error_->h(); 93 | } 94 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | PINEntry 2 | --------- 3 | 4 | This is a collection of PIN or passphrase entry dialogs which 5 | utilize the Assuan protocol as specified in the Libassuan manual. 6 | 7 | There are programs for different toolkits available. For all GUIs it 8 | is automatically detected which modules can be built, but it can also 9 | be requested explicitly. 10 | 11 | GUI OPTION DEPENDENCIES 12 | -------------------------------------------------------------------------- 13 | GTK+ V2.0 --enable-pinentry-gtk2 Gimp Toolkit Library, Version 2.0 14 | eg. libgtk-x11-2.0 and libglib-2.0 15 | GNOME --enable-pinentry-gnome GNOME 16 | Qt --enable-pinentry-qt Qt (> 4.4.0) 17 | TQt --enable-pinentry-tqt Trinity Qt 18 | Enlightenment --enable-pinentry-efl EFL (>= 1.18) 19 | FLTK --enable-pinentry-fltk Fast Light Toolkit (>= 1.3) 20 | Curses --enable-pinentry-curses Curses library, for example ncurses 21 | TTY --enable-pinentry-tty Simple TTY version, no dependencies 22 | 23 | The GTK+, GNOME, and Qt pinentries can fall back to curses mode. The 24 | option to enable this is --enable-fallback-curses, but this is also 25 | detected automatically in the same way --enable-pinentry-curses is. 26 | The fallback to curses also works if --disable-pinentry-curses is 27 | specified. So to disable linking to curses completely you have to 28 | pass --disable-fallback-curses to the configure script as well. 29 | 30 | Examples: 31 | * To only build the GTK+ pinentry with curses support: 32 | ./configure --enable-pinentry-gtk2 --enable-fallback-curses \ 33 | --disable-pinentry-curses --disable-pinentry-qt 34 | 35 | * To build the Qt pinentry, and the other pinentries if they are 36 | supported: 37 | ./configure --enable-pinentry-qt 38 | 39 | * To build everything that is supported (complete auto-detection): 40 | ./configure 41 | 42 | Some of the code is taken from Robert Bihlmeyer's Quintuple-Agent. 43 | For security reasons, all internationalization has been removed. The 44 | client is expected to tell the PIN entry the text strings to be 45 | displayed. 46 | 47 | 48 | Curses Pinentry 49 | --------------- 50 | 51 | The curses pinentry supports colors if the terminal does. The colors 52 | can be specified by the --colors=FG,BG,SO option, which sets the 53 | foreground, background and standout colors respectively. The standout 54 | color is used for error messages. Colors can be named by any of 55 | "black", "red", "green", "yellow", "blue", "magenta", "cyan" and 56 | "white". The foreground and standout color can be prefixed by 57 | "bright-", "bright", "bold-" and "bold", and any of these prefixes has 58 | the same effect of making the color bolder or brighter. Two special 59 | color names are defined as well: "default" chooses the default color, 60 | and "none" disables use of colors. The name "none" is only meaningful 61 | for the standout color and in this case a reversed effect is used for 62 | error messages. For the other colors, disabling colors means the same 63 | as using the defaults. The default colors are as follows: 64 | 65 | Foreground: Terminal default 66 | Background: Terminal default 67 | Standout: Bright red 68 | 69 | Note that color support is limited by the capabilities of the display 70 | terminal. Some color combinations can be very difficult to read, and 71 | please know that colors are perceived differently by different people. 72 | -------------------------------------------------------------------------------- /fltk/pinwindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | pinwindow.h - PinWindow is a simple fltk dialog for entring password 3 | with timeout. if needed description (long text), error message, qualitybar 4 | and etc should used PassWindow. 5 | 6 | Copyright (C) 2016 Anatoly madRat L. Berenblit 7 | 8 | Written by Anatoly madRat L. Berenblit . 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License as 12 | published by the Free Software Foundation; either version 2 of the 13 | License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 23 | SPDX-License-Identifier: GPL-2.0+ 24 | */ 25 | 26 | #ifndef __PINWINDOW_H__ 27 | #define __PINWINDOW_H__ 28 | 29 | #include "config.h" 30 | 31 | class Fl_Window; 32 | class Fl_Box; 33 | class Fl_Input; 34 | class Fl_Button; 35 | class Fl_Widget; 36 | 37 | #include 38 | #include 39 | 40 | class PinWindow 41 | { 42 | protected: 43 | static const char *TITLE; 44 | static const char *BUTTON_OK; 45 | static const char *BUTTON_CANCEL; 46 | static const char *PROMPT; 47 | 48 | protected: 49 | PinWindow(const PinWindow&); 50 | PinWindow& operator=(const PinWindow&); 51 | 52 | Fl_Window *window_; 53 | Fl_Box *icon_; 54 | 55 | Fl_Box *message_; 56 | Fl_Input *input_; 57 | 58 | Fl_Button *ok_, *cancel_; 59 | 60 | std::string cancel_name_; 61 | char *passwd_; // SECURE_MEMORY 62 | unsigned int timeout_; // click cancel if timeout 63 | 64 | public: 65 | virtual ~PinWindow(); 66 | 67 | static PinWindow* create(); 68 | 69 | inline const char* passwd() const { return passwd_; } 70 | 71 | virtual void timeout(unsigned int time); // 0 - infinity, seconds 72 | virtual void title(const char *title); 73 | virtual void ok(const char* ok); 74 | virtual void cancel(const char* cancel); 75 | virtual void prompt(const char *message); 76 | 77 | virtual void showModal(); 78 | virtual void showModal(const int argc, char* argv[]); 79 | 80 | protected: 81 | PinWindow(); 82 | 83 | void wipe(); // clear UI memory 84 | void release(); // clear secure memory 85 | void update_cancel_label(); 86 | 87 | virtual int init(const int cx, const int cy); 88 | 89 | //callbacks 90 | static void cancel_cb(Fl_Widget *button, void *val); 91 | static void ok_cb(Fl_Widget *button, void *val); 92 | static void timeout_cb(void*); 93 | 94 | // ISSUE: Fl_Window component in tinycore works only as Fl_Window::label(...); not Fl_Widget 95 | template void set_label(TWidget* widget, const char *label, const char *def) 96 | { 97 | assert(NULL != widget); // widget must be created 98 | 99 | if (NULL != widget) 100 | { 101 | if (NULL != label && 0 != *label) 102 | widget->copy_label(label); 103 | else 104 | widget->label(def); 105 | } 106 | }; 107 | }; 108 | 109 | #endif //#ifndef __PINWINDOW_H__ 110 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf macros used by PINENTRY 2 | dnl 3 | dnl Copyright (C) 2002, 2022 g10 Code GmbH 4 | dnl 5 | dnl 6 | ###################################################################### 7 | # Check whether mlock is broken (hpux 10.20 raises a SIGBUS if mlock 8 | # is not called from uid 0 (not tested whether uid 0 works) 9 | # For DECs Tru64 we have also to check whether mlock is in librt 10 | # mlock is there a macro using memlk() 11 | ###################################################################### 12 | dnl GNUPG_CHECK_MLOCK 13 | dnl 14 | define(GNUPG_CHECK_MLOCK, 15 | [ AC_CHECK_FUNCS(mlock) 16 | if test "$ac_cv_func_mlock" = "no"; then 17 | AC_CHECK_HEADERS(sys/mman.h) 18 | if test "$ac_cv_header_sys_mman_h" = "yes"; then 19 | # Add librt to LIBS: 20 | AC_CHECK_LIB(rt, memlk) 21 | AC_CACHE_CHECK([whether mlock is in sys/mman.h], 22 | gnupg_cv_mlock_is_in_sys_mman, 23 | [AC_LINK_IFELSE( 24 | [AC_LANG_PROGRAM([[ 25 | #include 26 | #ifdef HAVE_SYS_MMAN_H 27 | #include 28 | #endif 29 | ]], [[ 30 | int i; 31 | 32 | /* glibc defines this for functions which it implements 33 | * to always fail with ENOSYS. Some functions are actually 34 | * named something starting with __ and the normal name 35 | * is an alias. */ 36 | #if defined (__stub_mlock) || defined (__stub___mlock) 37 | choke me 38 | #else 39 | mlock(&i, 4); 40 | #endif 41 | ; return 0; 42 | ]])], 43 | gnupg_cv_mlock_is_in_sys_mman=yes, 44 | gnupg_cv_mlock_is_in_sys_mman=no)]) 45 | if test "$gnupg_cv_mlock_is_in_sys_mman" = "yes"; then 46 | AC_DEFINE(HAVE_MLOCK,1, 47 | [Defined if the system supports an mlock() call]) 48 | fi 49 | fi 50 | fi 51 | if test "$ac_cv_func_mlock" = "yes"; then 52 | AC_CHECK_FUNCS(sysconf getpagesize) 53 | AC_MSG_CHECKING(whether mlock is broken) 54 | AC_CACHE_VAL(gnupg_cv_have_broken_mlock, 55 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | 63 | int main() 64 | { 65 | char *pool; 66 | int err; 67 | long int pgsize; 68 | 69 | #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) 70 | pgsize = sysconf (_SC_PAGESIZE); 71 | #elif defined (HAVE_GETPAGESIZE) 72 | pgsize = getpagesize(); 73 | #else 74 | pgsize = -1; 75 | #endif 76 | 77 | if (pgsize == -1) 78 | pgsize = 4096; 79 | 80 | pool = malloc( 4096 + pgsize ); 81 | if( !pool ) 82 | return 2; 83 | pool += (pgsize - ((size_t)pool % pgsize)); 84 | 85 | err = mlock( pool, 4096 ); 86 | if( !err || errno == EPERM || errno == EAGAIN) 87 | return 0; /* okay */ 88 | 89 | return 1; /* hmmm */ 90 | } 91 | ]])], 92 | gnupg_cv_have_broken_mlock="no", 93 | gnupg_cv_have_broken_mlock="yes", 94 | gnupg_cv_have_broken_mlock="assume-no" 95 | ) 96 | ) 97 | if test "$gnupg_cv_have_broken_mlock" = "yes"; then 98 | AC_DEFINE(HAVE_BROKEN_MLOCK,1, 99 | [Defined if the mlock() call does not work]) 100 | AC_MSG_RESULT(yes) 101 | else 102 | if test "$gnupg_cv_have_broken_mlock" = "no"; then 103 | AC_MSG_RESULT(no) 104 | else 105 | AC_MSG_RESULT(assuming no) 106 | fi 107 | fi 108 | fi 109 | ]) 110 | -------------------------------------------------------------------------------- /qt/qti18n.cpp: -------------------------------------------------------------------------------- 1 | /* qti18n.cpp - Load qt translations for pinentry. 2 | * Copyright 2021 g10 Code GmbH 3 | * SPDX-FileCopyrightText: 2015 Lukáš Tinkl 4 | * SPDX-FileCopyrightText: 2021 Ingo Klöcker 5 | * 6 | * Copied from k18n under the terms of LGPLv2 or later. 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License as 10 | * published by the Free Software Foundation; either version 2 of the 11 | * License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, see . 20 | * SPDX-License-Identifier: GPL-2.0+ 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | static bool loadCatalog(const QString &catalog, const QLocale &locale) 32 | { 33 | auto translator = new QTranslator(QCoreApplication::instance()); 34 | 35 | if (!translator->load(locale, catalog, QString(), QLibraryInfo::path(QLibraryInfo::TranslationsPath))) { 36 | qDebug() << "Loading the" << catalog << "catalog failed for locale" << locale; 37 | delete translator; 38 | return false; 39 | } 40 | QCoreApplication::instance()->installTranslator(translator); 41 | return true; 42 | } 43 | 44 | static bool loadCatalog(const QString &catalog, const QLocale &locale, const QLocale &fallbackLocale) 45 | { 46 | // try to load the catalog for locale 47 | if (loadCatalog(catalog, locale)) { 48 | return true; 49 | } 50 | // if this fails, then try the fallback locale (if it's different from locale) 51 | if (fallbackLocale != locale) { 52 | return loadCatalog(catalog, fallbackLocale); 53 | } 54 | return false; 55 | } 56 | 57 | // load global Qt translation, needed in KDE e.g. by lots of builtin dialogs (QColorDialog, QFontDialog) that we use 58 | static void loadTranslation(const QString &localeName, const QString &fallbackLocaleName) 59 | { 60 | const QLocale locale{localeName}; 61 | const QLocale fallbackLocale{fallbackLocaleName}; 62 | // first, try to load the qt_ meta catalog 63 | if (loadCatalog(QStringLiteral("qt_"), locale, fallbackLocale)) { 64 | return; 65 | } 66 | // if loading the meta catalog failed, then try loading the four catalogs 67 | // it depends on, i.e. qtbase, qtscript, qtmultimedia, qtxmlpatterns, separately 68 | const auto catalogs = { 69 | QStringLiteral("qtbase_"), 70 | /* QStringLiteral("qtscript_"), 71 | QStringLiteral("qtmultimedia_"), 72 | QStringLiteral("qtxmlpatterns_"), */ 73 | }; 74 | for (const auto &catalog : catalogs) { 75 | loadCatalog(catalog, locale, fallbackLocale); 76 | } 77 | } 78 | 79 | static void load() 80 | { 81 | // The way Qt translation system handles plural forms makes it necessary to 82 | // have a translation file which contains only plural forms for `en`. That's 83 | // why we load the `en` translation unconditionally, then load the 84 | // translation for the current locale to overload it. 85 | loadCatalog(QStringLiteral("qt_"), QLocale{QStringLiteral("en")}); 86 | 87 | const QLocale locale = QLocale::system(); 88 | if (locale.name() != QStringLiteral("en")) { 89 | loadTranslation(locale.name(), locale.bcp47Name()); 90 | } 91 | } 92 | 93 | Q_COREAPP_STARTUP_FUNCTION(load) 94 | -------------------------------------------------------------------------------- /qt5/qti18n.cpp: -------------------------------------------------------------------------------- 1 | /* qti18n.cpp - Load qt translations for pinentry. 2 | * Copyright 2021 g10 Code GmbH 3 | * SPDX-FileCopyrightText: 2015 Lukáš Tinkl 4 | * SPDX-FileCopyrightText: 2021 Ingo Klöcker 5 | * 6 | * Copied from k18n under the terms of LGPLv2 or later. 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License as 10 | * published by the Free Software Foundation; either version 2 of the 11 | * License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, see . 20 | * SPDX-License-Identifier: GPL-2.0+ 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | static bool loadCatalog(const QString &catalog, const QLocale &locale) 32 | { 33 | auto translator = new QTranslator(QCoreApplication::instance()); 34 | 35 | if (!translator->load(locale, catalog, QString(), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { 36 | qDebug() << "Loading the" << catalog << "catalog failed for locale" << locale; 37 | delete translator; 38 | return false; 39 | } 40 | QCoreApplication::instance()->installTranslator(translator); 41 | return true; 42 | } 43 | 44 | static bool loadCatalog(const QString &catalog, const QLocale &locale, const QLocale &fallbackLocale) 45 | { 46 | // try to load the catalog for locale 47 | if (loadCatalog(catalog, locale)) { 48 | return true; 49 | } 50 | // if this fails, then try the fallback locale (if it's different from locale) 51 | if (fallbackLocale != locale) { 52 | return loadCatalog(catalog, fallbackLocale); 53 | } 54 | return false; 55 | } 56 | 57 | // load global Qt translation, needed in KDE e.g. by lots of builtin dialogs (QColorDialog, QFontDialog) that we use 58 | static void loadTranslation(const QString &localeName, const QString &fallbackLocaleName) 59 | { 60 | const QLocale locale{localeName}; 61 | const QLocale fallbackLocale{fallbackLocaleName}; 62 | // first, try to load the qt_ meta catalog 63 | if (loadCatalog(QStringLiteral("qt_"), locale, fallbackLocale)) { 64 | return; 65 | } 66 | // if loading the meta catalog failed, then try loading the four catalogs 67 | // it depends on, i.e. qtbase, qtscript, qtmultimedia, qtxmlpatterns, separately 68 | const auto catalogs = { 69 | QStringLiteral("qtbase_"), 70 | /* QStringLiteral("qtscript_"), 71 | QStringLiteral("qtmultimedia_"), 72 | QStringLiteral("qtxmlpatterns_"), */ 73 | }; 74 | for (const auto &catalog : catalogs) { 75 | loadCatalog(catalog, locale, fallbackLocale); 76 | } 77 | } 78 | 79 | static void load() 80 | { 81 | // The way Qt translation system handles plural forms makes it necessary to 82 | // have a translation file which contains only plural forms for `en`. That's 83 | // why we load the `en` translation unconditionally, then load the 84 | // translation for the current locale to overload it. 85 | loadCatalog(QStringLiteral("qt_"), QLocale{QStringLiteral("en")}); 86 | 87 | const QLocale locale = QLocale::system(); 88 | if (locale.name() != QStringLiteral("en")) { 89 | loadTranslation(locale.name(), locale.bcp47Name()); 90 | } 91 | } 92 | 93 | Q_COREAPP_STARTUP_FUNCTION(load) 94 | -------------------------------------------------------------------------------- /m4/qt6.m4: -------------------------------------------------------------------------------- 1 | dnl qt6.m4 2 | dnl Copyright (C) 2016 Intevation GmbH 3 | dnl 4 | dnl This file is part of pinentry and is provided under the same license as pinentry 5 | 6 | dnl Autoconf macro to find Qt6 7 | dnl 8 | dnl sets PINENTRY_QT6_LIBS and PINENTRY_QT6_CFLAGS 9 | dnl 10 | dnl if QT6 was found have_qt6_libs is set to yes 11 | 12 | AC_DEFUN([FIND_QT6], 13 | [ 14 | have_qt6_libs="no"; 15 | 16 | PKG_CHECK_MODULES(PINENTRY_QT6, 17 | Qt6Core >= 6.4.0 Qt6Gui >= 6.4.0 Qt6Widgets >= 6.4.0, 18 | [have_qt6_libs="yes"], 19 | [have_qt6_libs="no"]) 20 | 21 | PKG_CHECK_MODULES(PINENTRY_QT6TEST, 22 | Qt6Test >= 6.4.0, 23 | [have_qt6test_libs="yes"], 24 | [have_qt6test_libs="no"]) 25 | 26 | if test "$have_qt6_libs" = "yes"; then 27 | # Qt6 moved moc to libexec 28 | qt6libexecdir=$($PKG_CONFIG --variable=libexecdir 'Qt6Core >= 6.4.0') 29 | AC_PATH_TOOL(MOC6, moc, [], [$qt6libexecdir]) 30 | if test -z "$MOC6"; then 31 | AC_MSG_WARN([moc not found - Qt 6 binding will not be built.]) 32 | have_qt6_libs="no"; 33 | fi 34 | AC_PATH_TOOL(RCC6, rcc, [], [$qt6libexecdir]) 35 | if test -z "$RCC6"; then 36 | AC_MSG_WARN([rcc not found - Qt 6 binding will not be built.]) 37 | have_qt6_libs="no"; 38 | fi 39 | fi 40 | 41 | if test "$have_qt6_libs" = "yes"; then 42 | if test "$have_w32_system" != yes; then 43 | mkspecsdir=$($PKG_CONFIG --variable mkspecsdir Qt6Platform) 44 | if test -z "$mkspecsdir"; then 45 | AC_MSG_WARN([Failed to determine Qt's mkspecs directory. Cannot check its build configuration.]) 46 | fi 47 | fi 48 | 49 | # check if we need -fPIC 50 | if test -z "$use_reduce_relocations" && test -n "$mkspecsdir"; then 51 | AC_MSG_CHECKING([whether Qt was built with -fPIC]) 52 | if grep -q "QT_CONFIG .* reduce_relocations" $mkspecsdir/qconfig.pri; then 53 | use_reduce_relocations="yes" 54 | else 55 | use_reduce_relocations="no" 56 | fi 57 | AC_MSG_RESULT([$use_reduce_relocations]) 58 | fi 59 | if test "$use_reduce_relocations" = yes; then 60 | PINENTRY_QT6_CFLAGS="$PINENTRY_QT6_CFLAGS -fPIC" 61 | fi 62 | 63 | # check if we need -mno-direct-extern-access 64 | if test "$have_no_direct_extern_access" = yes; then 65 | if test -z "$use_no_direct_extern_access" && test -n "$mkspecsdir"; then 66 | AC_MSG_CHECKING([whether Qt was built with -mno-direct-extern-access]) 67 | if grep -q "QT_CONFIG .* no_direct_extern_access" $mkspecsdir/qconfig.pri; then 68 | use_no_direct_extern_access="yes" 69 | else 70 | use_no_direct_extern_access="no" 71 | fi 72 | AC_MSG_RESULT([$use_no_direct_extern_access]) 73 | fi 74 | if test "$use_no_direct_extern_access" = yes; then 75 | PINENTRY_QT6_CFLAGS="$PINENTRY_QT6_CFLAGS -mno-direct-extern-access" 76 | fi 77 | fi 78 | 79 | dnl Check that a binary can actually be build with this qt. 80 | dnl pkg-config may be set up in a way that it looks also for libraries 81 | dnl of the build system and not only for the host system. In that case 82 | dnl we check here that we can actually compile / link a qt application 83 | dnl for host. 84 | OLDCPPFLAGS=$CPPFLAGS 85 | OLDLIBS=$LIBS 86 | 87 | CPPFLAGS=$PINENTRY_QT6_CFLAGS 88 | LIBS=$PINENTRY_QT6_LIBS 89 | AC_LANG_PUSH(C++) 90 | AC_MSG_CHECKING([whether a simple Qt program can be built]) 91 | AC_LINK_IFELSE([AC_LANG_SOURCE([ 92 | #include 93 | int main (int argc, char **argv) { 94 | QCoreApplication app(argc, argv); 95 | app.exec(); 96 | }])], [have_qt6_libs='yes'], [have_qt6_libs='no']) 97 | AC_MSG_RESULT([$have_qt6_libs]) 98 | AC_LANG_POP() 99 | 100 | CPPFLAGS=$OLDCPPFLAGS 101 | LIBS=$OLDLIBS 102 | fi 103 | ]) 104 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | 4 | scriptversion=2006-05-11.19 5 | 6 | # Original author: Noah Friedman 7 | # Created: 1993-05-16 8 | # Public domain. 9 | # 10 | # This file is maintained in Automake, please report 11 | # bugs to or send patches to 12 | # . 13 | 14 | nl=' 15 | ' 16 | IFS=" "" $nl" 17 | errstatus=0 18 | dirmode= 19 | 20 | usage="\ 21 | Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 22 | 23 | Create each directory DIR (with mode MODE, if specified), including all 24 | leading file name components. 25 | 26 | Report bugs to ." 27 | 28 | # process command line arguments 29 | while test $# -gt 0 ; do 30 | case $1 in 31 | -h | --help | --h*) # -h for help 32 | echo "$usage" 33 | exit $? 34 | ;; 35 | -m) # -m PERM arg 36 | shift 37 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 38 | dirmode=$1 39 | shift 40 | ;; 41 | --version) 42 | echo "$0 $scriptversion" 43 | exit $? 44 | ;; 45 | --) # stop option processing 46 | shift 47 | break 48 | ;; 49 | -*) # unknown option 50 | echo "$usage" 1>&2 51 | exit 1 52 | ;; 53 | *) # first non-opt arg 54 | break 55 | ;; 56 | esac 57 | done 58 | 59 | for file 60 | do 61 | if test -d "$file"; then 62 | shift 63 | else 64 | break 65 | fi 66 | done 67 | 68 | case $# in 69 | 0) exit 0 ;; 70 | esac 71 | 72 | # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and 73 | # mkdir -p a/c at the same time, both will detect that a is missing, 74 | # one will create a, then the other will try to create a and die with 75 | # a "File exists" error. This is a problem when calling mkinstalldirs 76 | # from a parallel make. We use --version in the probe to restrict 77 | # ourselves to GNU mkdir, which is thread-safe. 78 | case $dirmode in 79 | '') 80 | if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then 81 | echo "mkdir -p -- $*" 82 | exec mkdir -p -- "$@" 83 | else 84 | # On NextStep and OpenStep, the `mkdir' command does not 85 | # recognize any option. It will interpret all options as 86 | # directories to create, and then abort because `.' already 87 | # exists. 88 | test -d ./-p && rmdir ./-p 89 | test -d ./--version && rmdir ./--version 90 | fi 91 | ;; 92 | *) 93 | if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && 94 | test ! -d ./--version; then 95 | echo "mkdir -m $dirmode -p -- $*" 96 | exec mkdir -m "$dirmode" -p -- "$@" 97 | else 98 | # Clean up after NextStep and OpenStep mkdir. 99 | for d in ./-m ./-p ./--version "./$dirmode"; 100 | do 101 | test -d $d && rmdir $d 102 | done 103 | fi 104 | ;; 105 | esac 106 | 107 | for file 108 | do 109 | case $file in 110 | /*) pathcomp=/ ;; 111 | *) pathcomp= ;; 112 | esac 113 | oIFS=$IFS 114 | IFS=/ 115 | set fnord $file 116 | shift 117 | IFS=$oIFS 118 | 119 | for d 120 | do 121 | test "x$d" = x && continue 122 | 123 | pathcomp=$pathcomp$d 124 | case $pathcomp in 125 | -*) pathcomp=./$pathcomp ;; 126 | esac 127 | 128 | if test ! -d "$pathcomp"; then 129 | echo "mkdir $pathcomp" 130 | 131 | mkdir "$pathcomp" || lasterr=$? 132 | 133 | if test ! -d "$pathcomp"; then 134 | errstatus=$lasterr 135 | else 136 | if test ! -z "$dirmode"; then 137 | echo "chmod $dirmode $pathcomp" 138 | lasterr= 139 | chmod "$dirmode" "$pathcomp" || lasterr=$? 140 | 141 | if test ! -z "$lasterr"; then 142 | errstatus=$lasterr 143 | fi 144 | fi 145 | fi 146 | fi 147 | 148 | pathcomp=$pathcomp/ 149 | done 150 | done 151 | 152 | exit $errstatus 153 | 154 | # Local Variables: 155 | # mode: shell-script 156 | # sh-indentation: 2 157 | # eval: (add-hook 'write-file-hooks 'time-stamp) 158 | # time-stamp-start: "scriptversion=" 159 | # time-stamp-format: "%:y-%02m-%02d.%02H" 160 | # time-stamp-end: "$" 161 | # End: 162 | -------------------------------------------------------------------------------- /qt4/pinentrydialog.h: -------------------------------------------------------------------------------- 1 | /* pinentrydialog.h - A (not yet) secure Qt 4 dialog for PIN entry. 2 | * Copyright (C) 2002, 2008 Klarälvdalens Datakonsult AB (KDAB) 3 | * Copyright 2007 Ingo Klöcker 4 | * Copyright 2016 Intevation GmbH 5 | * 6 | * Written by Steffen Hansen . 7 | * Modified by Andre Heinecke 8 | * 9 | * This program is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU General Public License as 11 | * published by the Free Software Foundation; either version 2 of the 12 | * License, or (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, but 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, see . 21 | * SPDX-License-Identifier: GPL-2.0+ 22 | */ 23 | 24 | #ifndef __PINENTRYDIALOG_H__ 25 | #define __PINENTRYDIALOG_H__ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "pinentry.h" 32 | 33 | class QLabel; 34 | class QPushButton; 35 | class QLineEdit; 36 | class PinLineEdit; 37 | class QString; 38 | class QProgressBar; 39 | class QCheckBox; 40 | class QAction; 41 | 42 | QPixmap icon(QStyle::StandardPixmap which = QStyle::SP_CustomBase); 43 | 44 | void raiseWindow(QWidget *w); 45 | 46 | class PinEntryDialog : public QDialog 47 | { 48 | Q_OBJECT 49 | 50 | Q_PROPERTY(QString description READ description WRITE setDescription) 51 | Q_PROPERTY(QString error READ error WRITE setError) 52 | Q_PROPERTY(QString pin READ pin WRITE setPin) 53 | Q_PROPERTY(QString prompt READ prompt WRITE setPrompt) 54 | public: 55 | explicit PinEntryDialog(QWidget *parent = 0, const char *name = 0, 56 | int timeout = 0, bool modal = false, 57 | bool enable_quality_bar = false, 58 | const QString &repeatString = QString(), 59 | const QString &visibiltyTT = QString(), 60 | const QString &hideTT = QString()); 61 | 62 | void setDescription(const QString &); 63 | QString description() const; 64 | 65 | void setError(const QString &); 66 | QString error() const; 67 | 68 | void setPin(const QString &); 69 | QString pin() const; 70 | 71 | QString repeatedPin() const; 72 | void setRepeatErrorText(const QString &); 73 | 74 | void setPrompt(const QString &); 75 | QString prompt() const; 76 | 77 | void setOkText(const QString &); 78 | void setCancelText(const QString &); 79 | 80 | void setQualityBar(const QString &); 81 | void setQualityBarTT(const QString &); 82 | 83 | void setGenpinLabel(const QString &); 84 | void setGenpinTT(const QString &); 85 | 86 | void setPinentryInfo(pinentry_t); 87 | 88 | bool timedOut() const; 89 | 90 | protected slots: 91 | void updateQuality(const QString &); 92 | void slotTimeout(); 93 | void textChanged(const QString &); 94 | void focusChanged(QWidget *old, QWidget *now); 95 | void toggleVisibility(); 96 | void onBackspace(); 97 | void generatePin(); 98 | 99 | protected: 100 | /* reimp */ void showEvent(QShowEvent *event); 101 | 102 | private: 103 | QLabel *_icon; 104 | QLabel *_desc; 105 | QLabel *_error; 106 | QLabel *_prompt; 107 | QLabel *_quality_bar_label; 108 | QProgressBar *_quality_bar; 109 | PinLineEdit *_edit; 110 | QLineEdit *mRepeat; 111 | QPushButton *_ok; 112 | QPushButton *_cancel; 113 | bool _grabbed; 114 | bool _have_quality_bar; 115 | bool _timed_out; 116 | bool _disable_echo_allowed; 117 | pinentry_t _pinentry_info; 118 | QTimer *_timer; 119 | QString mRepeatError, 120 | mVisibilityTT, 121 | mGenerateTT, 122 | mHideTT; 123 | QAction *mVisiActionEdit, 124 | *mGenerateActionEdit; 125 | QCheckBox *mVisiCB; 126 | }; 127 | 128 | #endif // __PINENTRYDIALOG_H__ 129 | -------------------------------------------------------------------------------- /qt/pinentryconfirm.cpp: -------------------------------------------------------------------------------- 1 | /* pinentryconfirm.cpp - A QMessageBox with a timeout 2 | * 3 | * Copyright (C) 2011 Ben Kibbey 4 | * Copyright (C) 2022 g10 Code GmbH 5 | * 6 | * Software engineering by Ingo Klöcker 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License as 10 | * published by the Free Software Foundation; either version 2 of the 11 | * License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, see . 20 | * SPDX-License-Identifier: GPL-2.0+ 21 | */ 22 | 23 | #include "pinentryconfirm.h" 24 | 25 | #include "accessibility.h" 26 | #include "pinentrydialog.h" 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace 36 | { 37 | QLabel *messageBoxLabel(QMessageBox *messageBox) 38 | { 39 | return messageBox->findChild(QStringLiteral("qt_msgbox_label")); 40 | } 41 | } 42 | 43 | PinentryConfirm::PinentryConfirm(Icon icon, const QString &title, const QString &text, 44 | StandardButtons buttons, QWidget *parent, Qt::WindowFlags flags) 45 | : QMessageBox{icon, title, text, buttons, parent, flags} 46 | { 47 | _timer.callOnTimeout(this, &PinentryConfirm::slotTimeout); 48 | 49 | #ifndef QT_NO_ACCESSIBILITY 50 | QAccessible::installActivationObserver(this); 51 | accessibilityActiveChanged(QAccessible::isActive()); 52 | #endif 53 | 54 | #if QT_VERSION >= 0x050000 55 | /* This is in line with PinentryDialog ctor to have a maximizing 56 | * animation when opening. */ 57 | if (qApp->platformName() != QLatin1String("wayland")) { 58 | setWindowState(Qt::WindowMinimized); 59 | QTimer::singleShot(0, this, [this] () { 60 | raiseWindow(this); 61 | }); 62 | } 63 | #else 64 | activateWindow(); 65 | raise(); 66 | #endif 67 | } 68 | 69 | PinentryConfirm::~PinentryConfirm() 70 | { 71 | #ifndef QT_NO_ACCESSIBILITY 72 | QAccessible::removeActivationObserver(this); 73 | #endif 74 | } 75 | 76 | void PinentryConfirm::setTimeout(std::chrono::seconds timeout) 77 | { 78 | _timer.setInterval(timeout); 79 | } 80 | 81 | std::chrono::seconds PinentryConfirm::timeout() const 82 | { 83 | return std::chrono::duration_cast(_timer.intervalAsDuration()); 84 | } 85 | 86 | bool PinentryConfirm::timedOut() const 87 | { 88 | return _timed_out; 89 | } 90 | 91 | void PinentryConfirm::showEvent(QShowEvent *event) 92 | { 93 | static bool resized; 94 | if (!resized) { 95 | QGridLayout* lay = dynamic_cast (layout()); 96 | if (lay) { 97 | QSize textSize = fontMetrics().size(Qt::TextExpandTabs, text(), fontMetrics().maxWidth()); 98 | QSpacerItem* horizontalSpacer = new QSpacerItem(textSize.width() + iconPixmap().width(), 99 | 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 100 | lay->addItem(horizontalSpacer, lay->rowCount(), 1, 1, lay->columnCount() - 1); 101 | } 102 | resized = true; 103 | } 104 | 105 | QMessageBox::showEvent(event); 106 | 107 | if (timeout() > std::chrono::milliseconds::zero()) { 108 | _timer.setSingleShot(true); 109 | _timer.start(); 110 | } 111 | } 112 | 113 | void PinentryConfirm::slotTimeout() 114 | { 115 | QAbstractButton *b = button(QMessageBox::Cancel); 116 | _timed_out = true; 117 | 118 | if (b) { 119 | b->animateClick(); 120 | } 121 | } 122 | 123 | #ifndef QT_NO_ACCESSIBILITY 124 | void PinentryConfirm::accessibilityActiveChanged(bool active) 125 | { 126 | // Allow text label to get focus if accessibility is active 127 | const auto focusPolicy = active ? Qt::StrongFocus : Qt::ClickFocus; 128 | if (auto label = messageBoxLabel(this)) { 129 | label->setFocusPolicy(focusPolicy); 130 | } 131 | } 132 | #endif 133 | 134 | #include "pinentryconfirm.moc" 135 | -------------------------------------------------------------------------------- /qt5/pinentryconfirm.cpp: -------------------------------------------------------------------------------- 1 | /* pinentryconfirm.cpp - A QMessageBox with a timeout 2 | * 3 | * Copyright (C) 2011 Ben Kibbey 4 | * Copyright (C) 2022 g10 Code GmbH 5 | * 6 | * Software engineering by Ingo Klöcker 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License as 10 | * published by the Free Software Foundation; either version 2 of the 11 | * License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, see . 20 | * SPDX-License-Identifier: GPL-2.0+ 21 | */ 22 | 23 | #include "pinentryconfirm.h" 24 | 25 | #include "accessibility.h" 26 | #include "pinentrydialog.h" 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace 36 | { 37 | QLabel *messageBoxLabel(QMessageBox *messageBox) 38 | { 39 | return messageBox->findChild(QStringLiteral("qt_msgbox_label")); 40 | } 41 | } 42 | 43 | PinentryConfirm::PinentryConfirm(Icon icon, const QString &title, const QString &text, 44 | StandardButtons buttons, QWidget *parent, Qt::WindowFlags flags) 45 | : QMessageBox{icon, title, text, buttons, parent, flags} 46 | { 47 | _timer.callOnTimeout(this, &PinentryConfirm::slotTimeout); 48 | 49 | #ifndef QT_NO_ACCESSIBILITY 50 | QAccessible::installActivationObserver(this); 51 | accessibilityActiveChanged(QAccessible::isActive()); 52 | #endif 53 | 54 | #if QT_VERSION >= 0x050000 55 | /* This is in line with PinentryDialog ctor to have a maximizing 56 | * animation when opening. */ 57 | if (qApp->platformName() != QLatin1String("wayland")) { 58 | setWindowState(Qt::WindowMinimized); 59 | QTimer::singleShot(0, this, [this] () { 60 | raiseWindow(this); 61 | }); 62 | } 63 | #else 64 | activateWindow(); 65 | raise(); 66 | #endif 67 | } 68 | 69 | PinentryConfirm::~PinentryConfirm() 70 | { 71 | #ifndef QT_NO_ACCESSIBILITY 72 | QAccessible::removeActivationObserver(this); 73 | #endif 74 | } 75 | 76 | void PinentryConfirm::setTimeout(std::chrono::seconds timeout) 77 | { 78 | _timer.setInterval(timeout); 79 | } 80 | 81 | std::chrono::seconds PinentryConfirm::timeout() const 82 | { 83 | return std::chrono::duration_cast(_timer.intervalAsDuration()); 84 | } 85 | 86 | bool PinentryConfirm::timedOut() const 87 | { 88 | return _timed_out; 89 | } 90 | 91 | void PinentryConfirm::showEvent(QShowEvent *event) 92 | { 93 | static bool resized; 94 | if (!resized) { 95 | QGridLayout* lay = dynamic_cast (layout()); 96 | if (lay) { 97 | QSize textSize = fontMetrics().size(Qt::TextExpandTabs, text(), fontMetrics().maxWidth()); 98 | QSpacerItem* horizontalSpacer = new QSpacerItem(textSize.width() + iconPixmap().width(), 99 | 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 100 | lay->addItem(horizontalSpacer, lay->rowCount(), 1, 1, lay->columnCount() - 1); 101 | } 102 | resized = true; 103 | } 104 | 105 | QMessageBox::showEvent(event); 106 | 107 | if (timeout() > std::chrono::milliseconds::zero()) { 108 | _timer.setSingleShot(true); 109 | _timer.start(); 110 | } 111 | } 112 | 113 | void PinentryConfirm::slotTimeout() 114 | { 115 | QAbstractButton *b = button(QMessageBox::Cancel); 116 | _timed_out = true; 117 | 118 | if (b) { 119 | b->animateClick(0); 120 | } 121 | } 122 | 123 | #ifndef QT_NO_ACCESSIBILITY 124 | void PinentryConfirm::accessibilityActiveChanged(bool active) 125 | { 126 | // Allow text label to get focus if accessibility is active 127 | const auto focusPolicy = active ? Qt::StrongFocus : Qt::ClickFocus; 128 | if (auto label = messageBoxLabel(this)) { 129 | label->setFocusPolicy(focusPolicy); 130 | } 131 | } 132 | #endif 133 | 134 | #include "pinentryconfirm.moc" 135 | -------------------------------------------------------------------------------- /qt5/capslock_unix.cpp: -------------------------------------------------------------------------------- 1 | /* capslock_unix.cpp - Helper to check whether Caps Lock is on 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * Software engineering by Ingo Klöcker 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 of the 9 | * License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include "config.h" 23 | #endif 24 | 25 | #include "capslock.h" 26 | #include "capslock_p.h" 27 | 28 | #if PINENTRY_QT5_WAYLAND 29 | # include 30 | # include 31 | # include 32 | # include 33 | #endif 34 | 35 | #include 36 | 37 | #if PINENTRY_QT5_X11 38 | # include 39 | # include 40 | # undef Status 41 | #endif 42 | 43 | #include 44 | 45 | #if PINENTRY_QT5_WAYLAND 46 | using namespace KWayland::Client; 47 | #endif 48 | 49 | #if PINENTRY_QT5_WAYLAND 50 | static bool watchingWayland = false; 51 | #endif 52 | 53 | LockState capsLockState() 54 | { 55 | static bool reportUnsupportedPlatform = true; 56 | #if PINENTRY_QT5_X11 57 | if (qApp->platformName() == QLatin1String("xcb")) { 58 | unsigned int state; 59 | XkbGetIndicatorState(QX11Info::display(), XkbUseCoreKbd, &state); 60 | return (state & 0x01) == 1 ? LockState::On : LockState::Off; 61 | } 62 | #endif 63 | #if PINENTRY_QT5_WAYLAND 64 | if (qApp->platformName() == QLatin1String("wayland")) { 65 | if (!watchingWayland && reportUnsupportedPlatform) { 66 | qDebug() << "Use CapsLockWatcher for checking for Caps Lock on Wayland"; 67 | } 68 | } else 69 | #endif 70 | if (reportUnsupportedPlatform) { 71 | qWarning() << "Checking for Caps Lock not possible on unsupported platform:" << qApp->platformName(); 72 | } 73 | reportUnsupportedPlatform = false; 74 | return LockState::Unknown; 75 | } 76 | 77 | #if PINENTRY_QT5_WAYLAND 78 | void CapsLockWatcher::Private::watchWayland() 79 | { 80 | watchingWayland = true; 81 | auto connection = ConnectionThread::fromApplication(q); 82 | if (!connection) { 83 | qWarning() << "Failed to get connection to Wayland server from QPA"; 84 | return; 85 | } 86 | registry = new Registry{q}; 87 | registry->create(connection); 88 | if (!registry->isValid()) { 89 | qWarning() << "Failed to create valid KWayland registry"; 90 | return; 91 | } 92 | registry->setup(); 93 | 94 | connect(registry, &Registry::seatAnnounced, 95 | q, [this] (quint32 name, quint32 version) { registry_seatAnnounced(name, version); }); 96 | } 97 | 98 | void CapsLockWatcher::Private::registry_seatAnnounced(quint32 name, quint32 version) 99 | { 100 | Q_ASSERT(registry); 101 | seat = registry->createSeat(name, version, q); 102 | if (!seat->isValid()) { 103 | qWarning() << "Failed to create valid KWayland seat"; 104 | return; 105 | } 106 | 107 | connect(seat, &Seat::hasKeyboardChanged, 108 | q, [this] (bool hasKeyboard) { seat_hasKeyboardChanged(hasKeyboard); }); 109 | } 110 | 111 | void CapsLockWatcher::Private::seat_hasKeyboardChanged(bool hasKeyboard) 112 | { 113 | Q_ASSERT(seat); 114 | 115 | if (!hasKeyboard) { 116 | qDebug() << "Seat has no keyboard"; 117 | return; 118 | } 119 | 120 | auto keyboard = seat->createKeyboard(q); 121 | if (!keyboard->isValid()) { 122 | qWarning() << "Failed to create valid KWayland keyboard"; 123 | return; 124 | } 125 | 126 | connect(keyboard, &Keyboard::modifiersChanged, 127 | q, [this] (quint32, quint32, quint32 locked, quint32) { keyboard_modifiersChanged(locked); }); 128 | } 129 | 130 | void CapsLockWatcher::Private::keyboard_modifiersChanged(quint32 locked) 131 | { 132 | const bool capsLockIsLocked = (locked & 2u) != 0; 133 | qDebug() << "Caps Lock is locked:" << capsLockIsLocked; 134 | Q_EMIT q->stateChanged(capsLockIsLocked); 135 | } 136 | #endif 137 | -------------------------------------------------------------------------------- /pinentry/password-cache.c: -------------------------------------------------------------------------------- 1 | /* password-cache.c - Password cache support. 2 | Copyright (C) 2015 g10 Code GmbH 3 | 4 | This file is part of PINENTRY. 5 | 6 | PINENTRY is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | PINENTRY is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, see . 18 | SPDX-License-Identifier: GPL-2.0+ 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | # include 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef HAVE_LIBSECRET 30 | # include 31 | #endif 32 | 33 | #include "password-cache.h" 34 | #include "../secmem/secmem.h" 35 | 36 | #ifdef HAVE_LIBSECRET 37 | static const SecretSchema * 38 | gpg_schema (void) 39 | { 40 | static const SecretSchema the_schema = { 41 | "org.gnupg.Passphrase", SECRET_SCHEMA_NONE, 42 | { 43 | { "stored-by", SECRET_SCHEMA_ATTRIBUTE_STRING }, 44 | { "keygrip", SECRET_SCHEMA_ATTRIBUTE_STRING }, 45 | { "NULL", 0 }, 46 | } 47 | }; 48 | return &the_schema; 49 | } 50 | 51 | static char * 52 | keygrip_to_label (const char *keygrip) 53 | { 54 | char const prefix[] = "GnuPG: "; 55 | char *label; 56 | 57 | label = malloc (sizeof (prefix) + strlen (keygrip)); 58 | if (label) 59 | { 60 | memcpy (label, prefix, sizeof (prefix) - 1); 61 | strcpy (&label[sizeof (prefix) - 1], keygrip); 62 | } 63 | return label; 64 | } 65 | #endif 66 | 67 | void 68 | password_cache_save (const char *keygrip, const char *password) 69 | { 70 | #ifdef HAVE_LIBSECRET 71 | char *label; 72 | GError *error = NULL; 73 | 74 | if (! *keygrip) 75 | return; 76 | 77 | label = keygrip_to_label (keygrip); 78 | if (! label) 79 | return; 80 | 81 | if (! secret_password_store_sync (gpg_schema (), 82 | SECRET_COLLECTION_DEFAULT, 83 | label, password, NULL, &error, 84 | "stored-by", "GnuPG Pinentry", 85 | "keygrip", keygrip, NULL)) 86 | { 87 | fprintf (stderr, "Failed to cache password for key %s with secret service: %s\n", 88 | keygrip, error->message); 89 | 90 | g_error_free (error); 91 | } 92 | 93 | free (label); 94 | #else 95 | (void) keygrip; 96 | (void) password; 97 | return; 98 | #endif 99 | } 100 | 101 | char * 102 | password_cache_lookup (const char *keygrip, int *fatal_error) 103 | { 104 | #ifdef HAVE_LIBSECRET 105 | GError *error = NULL; 106 | char *password; 107 | char *password2; 108 | 109 | if (! *keygrip) 110 | return NULL; 111 | 112 | password = secret_password_lookup_nonpageable_sync 113 | (gpg_schema (), NULL, &error, 114 | "keygrip", keygrip, NULL); 115 | 116 | if (error != NULL) 117 | { 118 | if (fatal_error) 119 | *fatal_error = 1; 120 | 121 | fprintf (stderr, "Failed to lookup password for key %s with secret service: %s\n", 122 | keygrip, error->message); 123 | g_error_free (error); 124 | return NULL; 125 | } 126 | if (! password) 127 | /* The password for this key is not cached. Just return NULL. */ 128 | return NULL; 129 | 130 | /* The password needs to be returned in secmem allocated memory. */ 131 | password2 = secmem_malloc (strlen (password) + 1); 132 | if (password2) 133 | strcpy(password2, password); 134 | else 135 | fprintf (stderr, "secmem_malloc failed: can't copy password!\n"); 136 | 137 | secret_password_free (password); 138 | 139 | return password2; 140 | #else 141 | (void) keygrip; 142 | (void) fatal_error; 143 | return NULL; 144 | #endif 145 | } 146 | 147 | /* Try and remove the cached password for key grip. Returns -1 on 148 | error, 0 if the key is not found and 1 if the password was 149 | removed. */ 150 | int 151 | password_cache_clear (const char *keygrip) 152 | { 153 | #ifdef HAVE_LIBSECRET 154 | GError *error = NULL; 155 | int removed = secret_password_clear_sync (gpg_schema (), NULL, &error, 156 | "keygrip", keygrip, NULL); 157 | if (error != NULL) 158 | { 159 | fprintf (stderr, "Failed to clear password for key %s with secret service: %s\n", 160 | keygrip, error->message); 161 | g_debug("%s", error->message); 162 | g_error_free (error); 163 | return -1; 164 | } 165 | if (removed) 166 | return 1; 167 | return 0; 168 | #else 169 | (void) keygrip; 170 | return -1; 171 | #endif 172 | } 173 | -------------------------------------------------------------------------------- /tqt/secqinternal_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** $Id$ 3 | ** 4 | ** Definition of some shared interal classes 5 | ** 6 | ** Created : 010427 7 | ** 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 9 | ** 10 | ** This file is part of the kernel module of the TQt GUI Toolkit. 11 | ** 12 | ** This file may be distributed under the terms of the Q Public License 13 | ** as defined by Trolltech AS of Norway and appearing in the file 14 | ** LICENSE.TQPL included in the packaging of this file. 15 | ** 16 | ** This file may be distributed and/or modified under the terms of the 17 | ** GNU General Public License version 2 as published by the Free Software 18 | ** Foundation and appearing in the file LICENSE.GPL included in the 19 | ** packaging of this file. 20 | ** 21 | ** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition 22 | ** licenses may use this file in accordance with the TQt Commercial License 23 | ** Agreement provided with the Software. 24 | ** 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 27 | ** 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 29 | ** information about TQt Commercial License Agreements. 30 | ** See http://www.trolltech.com/qpl/ for TQPL licensing information. 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. 32 | ** 33 | ** Contact info@trolltech.com if any conditions of this licensing are 34 | ** not clear to you. 35 | ** 36 | ** SPDX-License-Identifier: GPL-2.0 OR QPL-1.0 37 | ** 38 | **********************************************************************/ 39 | 40 | #ifndef SECTQINTERNAL_P_H 41 | #define SECTQINTERNAL_P_H 42 | 43 | // 44 | // W A R N I N G 45 | // ------------- 46 | // 47 | // This file is not part of the TQt API. It exists for the convenience 48 | // of a number of TQt sources files. This header file may change from 49 | // version to version without notice, or even be removed. 50 | // 51 | // We mean it. 52 | // 53 | // 54 | #ifndef QT_H 55 | #include "ntqnamespace.h" 56 | #include "ntqrect.h" 57 | #include "ntqptrlist.h" 58 | #include "ntqcstring.h" 59 | #include "ntqiodevice.h" 60 | #endif // QT_H 61 | 62 | class TQWidget; 63 | class TQPainter; 64 | class TQPixmap; 65 | 66 | class Q_EXPORT SecTQSharedDoubleBuffer 67 | { 68 | public: 69 | enum DoubleBufferFlags { 70 | NoFlags = 0x00, 71 | InitBG = 0x01, 72 | Force = 0x02, 73 | Default = InitBG | Force 74 | }; 75 | typedef uint DBFlags; 76 | 77 | SecTQSharedDoubleBuffer( DBFlags f = Default ); 78 | SecTQSharedDoubleBuffer( TQWidget* widget, 79 | int x = 0, int y = 0, int w = -1, int h = -1, 80 | DBFlags f = Default ); 81 | SecTQSharedDoubleBuffer( TQPainter* painter, 82 | int x = 0, int y = 0, int w = -1, int h = -1, 83 | DBFlags f = Default ); 84 | SecTQSharedDoubleBuffer( TQWidget *widget, const TQRect &r, DBFlags f = Default ); 85 | SecTQSharedDoubleBuffer( TQPainter *painter, const TQRect &r, DBFlags f = Default ); 86 | ~SecTQSharedDoubleBuffer(); 87 | 88 | bool begin( TQWidget* widget, int x = 0, int y = 0, int w = -1, int h = -1 ); 89 | bool begin( TQPainter* painter, int x = 0, int y = 0, int w = -1, int h = -1); 90 | bool begin( TQWidget* widget, const TQRect &r ); 91 | bool begin( TQPainter* painter, const TQRect &r ); 92 | bool end(); 93 | 94 | TQPainter* painter() const; 95 | 96 | bool isActive() const; 97 | bool isBuffered() const; 98 | void flush(); 99 | 100 | static bool isDisabled() { return !dblbufr; } 101 | static void setDisabled( bool off ) { dblbufr = !off; } 102 | 103 | static void cleanup(); 104 | 105 | private: 106 | enum DoubleBufferState { 107 | Active = 0x0100, 108 | BufferActive = 0x0200, 109 | ExternalPainter = 0x0400 110 | }; 111 | typedef uint DBState; 112 | 113 | TQPixmap *getPixmap(); 114 | void releasePixmap(); 115 | 116 | TQWidget *wid; 117 | int rx, ry, rw, rh; 118 | DBFlags flags; 119 | DBState state; 120 | 121 | TQPainter *p, *external_p; 122 | TQPixmap *pix; 123 | 124 | static bool dblbufr; 125 | }; 126 | 127 | inline bool SecTQSharedDoubleBuffer::begin( TQWidget* widget, const TQRect &r ) 128 | { return begin( widget, r.x(), r.y(), r.width(), r.height() ); } 129 | 130 | inline bool SecTQSharedDoubleBuffer::begin( TQPainter *painter, const TQRect &r ) 131 | { return begin( painter, r.x(), r.y(), r.width(), r.height() ); } 132 | 133 | inline TQPainter* SecTQSharedDoubleBuffer::painter() const 134 | { return p; } 135 | 136 | inline bool SecTQSharedDoubleBuffer::isActive() const 137 | { return ( state & Active ); } 138 | 139 | inline bool SecTQSharedDoubleBuffer::isBuffered() const 140 | { return ( state & BufferActive ); } 141 | 142 | #endif // SECTQINTERNAL_P_H 143 | -------------------------------------------------------------------------------- /m4/qt5.m4: -------------------------------------------------------------------------------- 1 | dnl qt5.m4 2 | dnl Copyright (C) 2015 Intevation GmbH 3 | dnl 4 | dnl This file is part of PINENTRY. 5 | dnl 6 | dnl PINENTRY is free software; you can redistribute it and/or modify 7 | dnl it under the terms of the GNU General Public License as published by 8 | dnl the Free Software Foundation; either version 2 of the License, or 9 | dnl (at your option) any later version. 10 | dnl 11 | dnl PINENTRY is distributed in the hope that it will be useful, 12 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | dnl GNU General Public License for more details. 15 | dnl 16 | dnl You should have received a copy of the GNU General Public License 17 | dnl along with this program; if not, write to the Free Software 18 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | dnl Autoconf macro to find Qt5 21 | dnl 22 | dnl sets PINENTRY_QT5_LIBS and PINENTRY_QT5_CFLAGS 23 | dnl 24 | dnl if Qt5 was found have_qt5_libs is set to yes 25 | dnl 26 | dnl The moc lookup code is based on libpoppler (rev. d821207) 27 | 28 | AC_DEFUN([FIND_QT5], 29 | [ 30 | AC_ARG_ENABLE(pinentry-qt5, 31 | AS_HELP_STRING([--disable-pinentry-qt5], 32 | [Don't use qt5 even if it is available.]), 33 | enable_pinentry_qt5=$enableval, 34 | enable_pinentry_qt5="try") 35 | 36 | have_qt5_libs="no"; 37 | require_qt5_cpp11="no"; 38 | 39 | if test "$enable_pinentry_qt5" != "no"; then 40 | PKG_CHECK_MODULES(PINENTRY_QT5, 41 | Qt5Core >= 5.0.0 Qt5Gui >= 5.0.0 Qt5Widgets >= 5.0.0, 42 | [have_qt5_libs="yes"], 43 | [have_qt5_libs="no"]) 44 | 45 | if "$PKG_CONFIG" --variable qt_config Qt5Core | grep -q "reduce_relocations"; then 46 | PINENTRY_QT5_CFLAGS="$PINENTRY_QT5_CFLAGS -fpic" 47 | fi 48 | fi 49 | if test "$have_qt5_libs" = "yes"; then 50 | PKG_CHECK_MODULES(PINENTRY_QT5_REQUIRE_CPP11, 51 | Qt5Core >= 5.7.0, 52 | [require_qt5_cpp11="yes"], 53 | [require_qt5_cpp11="no"]) 54 | 55 | if test "${require_qt5_cpp11}" = "yes"; then 56 | PINENTRY_QT5_CFLAGS="$PINENTRY_QT5_CFLAGS -std=c++11" 57 | fi 58 | 59 | qt5libdir=`"$PKG_CONFIG" --variable libdir Qt5Core` 60 | if test -n "$qt5libdir"; then 61 | if test "$enable_rpath" != "no"; then 62 | PINENTRY_QT5_LDFLAGS="$PINENTRY_QT5_LDFLAGS -Wl,-rpath \"$qt5libdir\"" 63 | fi 64 | fi 65 | 66 | if test "$have_x11" = "yes"; then 67 | PKG_CHECK_MODULES( 68 | PINENTRY_QT5_X11_EXTRAS, 69 | Qt5X11Extras >= 5.1.0, 70 | [have_qt5_x11extras="yes"], 71 | [ 72 | AC_MSG_WARN([pinentry-qt will be built without Caps Lock warning on X11]) 73 | have_qt5_x11extras="no" 74 | ]) 75 | if test "$have_qt5_x11extras" = "yes"; then 76 | PINENTRY_QT5_CFLAGS="$LIBX11_CFLAGS $PINENTRY_QT5_CFLAGS $PINENTRY_QT5_X11_EXTRAS_CFLAGS" 77 | PINENTRY_QT5_LIBS="$LIBX11_LIBS $PINENTRY_QT5_LIBS $PINENTRY_QT5_X11_EXTRAS_LIBS" 78 | fi 79 | fi 80 | 81 | AC_CHECK_TOOL(MOC5, moc) 82 | AC_MSG_CHECKING([moc version]) 83 | mocversion=`$MOC5 -v 2>&1` 84 | mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"` 85 | if test x"$mocversiongrep" != x"$mocversion"; then 86 | AC_MSG_RESULT([no]) 87 | # moc was not the qt5 one, try with moc-qt5 88 | AC_CHECK_TOOL(MOC5_2, moc-qt5) 89 | mocversion=`$MOC5_2 -v 2>&1` 90 | mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc-qt5 5|moc 5"` 91 | if test x"$mocversiongrep" != x"$mocversion"; then 92 | AC_CHECK_TOOL(QTCHOOSER, qtchooser) 93 | qt5tooldir=`QT_SELECT=qt5 qtchooser -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2` 94 | mocversion=`$qt5tooldir/moc -v 2>&1` 95 | mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"` 96 | if test x"$mocversiongrep" != x"$mocversion"; then 97 | # no valid moc found 98 | have_qt5_libs="no"; 99 | else 100 | MOC5=$qt5tooldir/moc 101 | fi 102 | else 103 | MOC5=$MOC5_2 104 | fi 105 | fi 106 | 107 | AC_CHECK_TOOL(RCC5, rcc) 108 | AC_MSG_CHECKING([rcc version]) 109 | rccversion=`$RCC5 -v 2>&1` 110 | rccversiongrep=`echo $rccversion | grep -E "Qt 5|rcc 5"` 111 | if test x"$rccversiongrep" != x"$rccversion"; then 112 | AC_MSG_RESULT([no]) 113 | # rcc was not the qt5 one, try with rcc-qt5 114 | AC_CHECK_TOOL(RCC5_2, rcc-qt5) 115 | rccversion=`$RCC5_2 -v 2>&1` 116 | rccversiongrep=`echo $rccversion | grep -E "Qt 5|rcc-qt5 5|rcc 5"` 117 | if test x"$rccversiongrep" != x"$rccversion"; then 118 | AC_CHECK_TOOL(QTCHOOSER, qtchooser) 119 | qt5tooldir=`QT_SELECT=qt5 qtchooser -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2` 120 | rccversion=`$qt5tooldir/rcc -v 2>&1` 121 | rccversiongrep=`echo $rccversion | grep -E "Qt 5|rcc 5"` 122 | if test x"$rccversiongrep" != x"$rccversion"; then 123 | # no valid rcc found 124 | have_qt5_libs="no"; 125 | else 126 | RCC5=$qt5tooldir/rcc 127 | fi 128 | else 129 | RCC5=$RCC5_2 130 | fi 131 | fi 132 | 133 | fi 134 | ]) 135 | -------------------------------------------------------------------------------- /m4/pkg.m4: -------------------------------------------------------------------------------- 1 | # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 2 | # 3 | # Copyright © 2004 Scott James Remnant . 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 | # 19 | # As a special exception to the GNU General Public License, if you 20 | # distribute this file as part of a program that contains a 21 | # configuration script generated by Autoconf, you may include it under 22 | # the same distribution terms that you use for the rest of that program. 23 | 24 | # PKG_PROG_PKG_CONFIG([MIN-VERSION]) 25 | # ---------------------------------- 26 | AC_DEFUN([PKG_PROG_PKG_CONFIG], 27 | [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 28 | m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) 29 | AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl 30 | if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 31 | AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) 32 | fi 33 | if test -n "$PKG_CONFIG"; then 34 | _pkg_min_version=m4_default([$1], [0.9.0]) 35 | AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) 36 | if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then 37 | AC_MSG_RESULT([yes]) 38 | else 39 | AC_MSG_RESULT([no]) 40 | PKG_CONFIG="" 41 | fi 42 | 43 | fi[]dnl 44 | ])# PKG_PROG_PKG_CONFIG 45 | 46 | # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 47 | # 48 | # Check to see whether a particular set of modules exists. Similar 49 | # to PKG_CHECK_MODULES(), but does not set variables or print errors. 50 | # 51 | # 52 | # Similar to PKG_CHECK_MODULES, make sure that the first instance of 53 | # this or PKG_CHECK_MODULES is called, or make sure to call 54 | # PKG_CHECK_EXISTS manually 55 | # -------------------------------------------------------------- 56 | AC_DEFUN([PKG_CHECK_EXISTS], 57 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 58 | if test -n "$PKG_CONFIG" && \ 59 | AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 60 | m4_ifval([$2], [$2], [:]) 61 | m4_ifvaln([$3], [else 62 | $3])dnl 63 | fi]) 64 | 65 | 66 | # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) 67 | # --------------------------------------------- 68 | m4_define([_PKG_CONFIG], 69 | [if test -n "$PKG_CONFIG"; then 70 | if test -n "$$1"; then 71 | pkg_cv_[]$1="$$1" 72 | else 73 | PKG_CHECK_EXISTS([$3], 74 | [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], 75 | [pkg_failed=yes]) 76 | fi 77 | else 78 | pkg_failed=untried 79 | fi[]dnl 80 | ])# _PKG_CONFIG 81 | 82 | # _PKG_SHORT_ERRORS_SUPPORTED 83 | # ----------------------------- 84 | AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], 85 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 86 | if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then 87 | _pkg_short_errors_supported=yes 88 | else 89 | _pkg_short_errors_supported=no 90 | fi[]dnl 91 | ])# _PKG_SHORT_ERRORS_SUPPORTED 92 | 93 | 94 | # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], 95 | # [ACTION-IF-NOT-FOUND]) 96 | # 97 | # 98 | # Note that if there is a possibility the first call to 99 | # PKG_CHECK_MODULES might not happen, you should be sure to include an 100 | # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac 101 | # 102 | # 103 | # -------------------------------------------------------------- 104 | AC_DEFUN([PKG_CHECK_MODULES], 105 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 106 | AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl 107 | AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl 108 | 109 | pkg_failed=no 110 | AC_MSG_CHECKING([for $2]) 111 | 112 | _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) 113 | _PKG_CONFIG([$1][_LIBS], [libs], [$2]) 114 | 115 | m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS 116 | and $1[]_LIBS to avoid the need to call pkg-config. 117 | See the pkg-config man page for more details.]) 118 | 119 | if test $pkg_failed = yes; then 120 | _PKG_SHORT_ERRORS_SUPPORTED 121 | if test $_pkg_short_errors_supported = yes; then 122 | $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` 123 | else 124 | $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` 125 | fi 126 | # Put the nasty error message in config.log where it belongs 127 | echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD 128 | 129 | ifelse([$4], , [AC_MSG_ERROR(dnl 130 | [Package requirements ($2) were not met: 131 | 132 | $$1_PKG_ERRORS 133 | 134 | Consider adjusting the PKG_CONFIG_PATH environment variable if you 135 | installed software in a non-standard prefix. 136 | 137 | _PKG_TEXT 138 | ])], 139 | [AC_MSG_RESULT([no]) 140 | $4]) 141 | elif test $pkg_failed = untried; then 142 | ifelse([$4], , [AC_MSG_FAILURE(dnl 143 | [The pkg-config script could not be found or is too old. Make sure it 144 | is in your PATH or set the PKG_CONFIG environment variable to the full 145 | path to pkg-config. 146 | 147 | _PKG_TEXT 148 | 149 | To get pkg-config, see .])], 150 | [$4]) 151 | else 152 | $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS 153 | $1[]_LIBS=$pkg_cv_[]$1[]_LIBS 154 | AC_MSG_RESULT([yes]) 155 | ifelse([$3], , :, [$3]) 156 | fi[]dnl 157 | ])# PKG_CHECK_MODULES 158 | --------------------------------------------------------------------------------