Switch from autotools/qmake to cmake

Why?
 - QT will switch from qmake to cmake sooner or later.
 - autotools are good for unix-ish systems, cmake also for
   macOS and Xcode as well as Windows and VS-code
 - Cross compiling the windows-binaries on linux
   is not very helpful to attract windows-centric
   developers.

Also drop qmake's xca.pro
Generate man-page and sphinx sources of commandline arguments
during build by executing xca (xcadoc.cpp).
Generating Version-patchlevel and git hash is now also
OS independent.
This commit is contained in:
Christian Hohnstädt 2021-05-12 10:46:07 +02:00
parent 1adcceaa66
commit 68273d0a30
54 changed files with 647 additions and 1366 deletions

18
.gitignore vendored
View File

@ -1,7 +1,3 @@
.depend
*qmake_qmake_immediate.*
.qmake.stash
.build-stamp
*.o
*.obj
*.rej
@ -10,19 +6,5 @@
*.h.gch
ui_*.h
moc_*
Local.mak
local.h
commithash.h
xca
xca.exe
setup_xca*.exe
xca_db_stat
xca_db_stat.exe
aclocal.m4
autom4te.cache/
config.cache
config.log
config.status
configure
misc/Info.plist
misc/variables.wxi

219
CMakeLists.txt Normal file
View File

@ -0,0 +1,219 @@
cmake_minimum_required(VERSION 3.9.0)
project(xca
DESCRIPTION "X Certificate and Key management"
HOMEPAGE_URL http://xca.hohnstaedt.de
LANGUAGES CXX
)
file(READ VERSION ver)
string(REGEX MATCH "([0-9\.]*)" _ ${ver})
set(PROJECT_VERSION ${CMAKE_MATCH_1})
include(GNUInstallDirs)
##### Git command to tweak the version and commit hash
include(cmake/git_version.cmake)
##### Build specifications
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC_SEARCH_PATHS "${PROJECT_SOURCE_DIR}/ui")
set(CMAKE_AUTOUIC ON)
configure_file(local.h.in local.h)
configure_file(doc/conf.py.in sphinx/rst/conf.py)
##### Libraries and executables
add_executable(${CMAKE_PROJECT_NAME} img/imgres.qrc)
add_executable(xcadoc xcadoc.cpp)
target_include_directories(xcadoc PRIVATE
"${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/lib")
find_package(OpenSSL REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Sql Help LinguistTools)
find_library(LTDL_LIB ltdl REQUIRED)
find_path(LTDL_INCLUDE_DIR ltdl.h REQUIRED)
add_subdirectory(lib)
add_subdirectory(widgets)
message(STATUS "OPENSSL ${OPENSSL_VERSION} - ${OPENSSL_LIBRARIES} - ${OPENSSL_INCLUDE_DIR}")
message(STATUS "LTDL_LIB ${LTDL_LIB}")
target_link_libraries(${CMAKE_PROJECT_NAME}
core widgets core
OpenSSL::Crypto
${LTDL_LIB}
Qt5::Widgets Qt5::Core Qt5::Sql Qt5::Help
)
target_link_libraries(xcadoc core Qt5::Core)
###### Translations
set(TS_FILES
lang/xca_de.ts lang/xca_ja.ts lang/xca_sk.ts
lang/xca_es.ts lang/xca_nl.ts lang/xca_tr.ts
lang/xca_fr.ts lang/xca_pl.ts lang/xca_zh_CN.ts
lang/xca_hr.ts lang/xca_pt_BR.ts
lang/xca_it.ts lang/xca_ru.ts
)
qt5_add_translation(QM_FILES ${TS_FILES})
add_custom_target(translations DEPENDS ${QM_FILES})
add_dependencies(${CMAKE_PROJECT_NAME} translations)
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${QM_FILES})
###### ICONS
set(ICONS "${PROJECT_BINARY_DIR}/xca-icons.icns")
file(GLOB ICON_SRC ${PROJECT_SOURCE_DIR}/img/xca-icons.iconset/*.png)
add_custom_command(OUTPUT ${ICONS}
COMMAND iconutil --convert icns -o ${ICONS}
${PROJECT_SOURCE_DIR}/img/xca-icons.iconset
DEPENDS ${ICON_SRC}
)
add_custom_target(mac-icons DEPENDS ${ICONS})
set_source_files_properties(${ICONS}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${ICONS})
##### SPHINX Documentation and man pages
include(cmake/sphinx-documentation.cmake)
##### XCA Templates
set(XCA_TEMPLATES misc/CA.xca misc/TLS_server.xca misc/TLS_client.xca)
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${XCA_TEMPLATES})
##### Text Files ids.txt eku.txt dn.txt
macro(Text_header file)
add_custom_command(OUTPUT misc/${file}.txt
COMMAND ${CMAKE_COMMAND} -DFILE=${file} -DSRC="${PROJECT_SOURCE_DIR}"
-P "${PROJECT_SOURCE_DIR}/cmake/text_header_file.cmake"
DEPENDS misc/${file}.text
)
set_source_files_properties("${PROJECT_SOURCE_DIR}misc/${file}.text"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)
list(APPEND TEXT_FILES "${PROJECT_BINARY_DIR}/misc/${file}.txt")
endmacro()
Text_header(dn)
Text_header(eku)
Text_header(oids)
add_custom_target(text_files ALL DEPENDS ${TEXT_FILES})
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${TEXT_FILES})
install(TARGETS ${CMAKE_PROJECT_NAME}
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
RESOURCE DESTINATION Resources
)
###############################################
##### Host specific settings
if (APPLE)
find_library(IOKIT_LIBRARY IOKit)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
target_link_libraries(${CMAKE_PROJECT_NAME}
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY}
)
set(CMAKE_MACOSX_BUNDLE ON)
set_property(TARGET ${PROJECT_NAME} PROPERTY MACOSX_BUNDLE_INFO_PLIST
"${PROJECT_SOURCE_DIR}/misc/Info.plist.in")
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
RESOURCE "${ICONS};${QM_FILES};${XCA_TEMPLATES};${TEXT_FILES}"
)
add_dependencies(${CMAKE_PROJECT_NAME} mac-icons)
# Note Mac specific extension .app
set(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app")
# Directories to look for dependencies
set(DIRS "${CMAKE_BINARY_DIR}")
# Path used for searching by FIND_XXX(), with appropriate suffixes added
if(CMAKE_PREFIX_PATH)
foreach(dir ${CMAKE_PREFIX_PATH})
list(APPEND DIRS "${dir}/bin" "${dir}/lib")
endforeach()
endif()
# Append Qt's lib folder which is two levels above Qt5Widgets_DIR
list(APPEND DIRS "${Qt5Widgets_DIR}/../..")
include(InstallRequiredSystemLibraries)
message(STATUS "APPS: ${APPS}")
message(STATUS "QT_PLUGINS: ${QT_PLUGINS}")
message(STATUS "DIRS: ${DIRS}")
install(CODE "include(BundleUtilities)
fixup_bundle(\"${APPS}\" \"${QT_PLUGINS}\" \"${DIRS}\")")
set(CPACK_GENERATOR "DRAGNDROP")
include(CPack)
endif (APPLE)
if (WIN32)
set(QT_USE_QTMAIN TRUE)
endif (WIN32)
if (UNIX AND NOT APPLE)
install(FILES ${QM_FILES} ${TEXT_FILES} ${XCA_TEMPLATES}
DESTINATION ${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}
)
install(FILES misc/xca.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
)
install(FILES misc/xca.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages)
install(DIRECTORY "${PROJECT_BINARY_DIR}/qthelp/"
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${CMAKE_PROJECT_NAME}
FILES_MATCHING PATTERN "*.html" PATTERN "xca.q[hc][ch]"
)
install(FILES "${PROJECT_BINARY_DIR}/xca.1.gz"
DESTINATION ${CMAKE_INSTALL_DATADIR}/man
)
install(FILES img/xca-32x32.xpm
DESTINATION ${CMAKE_INSTALL_DATADIR}/pixmaps
)
set(ICONDIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor)
macro(Install_PNG size)
install(FILES img/xca-icons.iconset/icon_${size}.png
DESTINATION ${ICONDIR}/${size}/apps RENAME xca.png
)
install(FILES img/xca-icons.iconset/icon_${size}.png
DESTINATION ${ICONDIR}/${size}/mimetypes RENAME x-xca-database.png
)
install(FILES img/xca-icons.iconset/icon_${size}.png
DESTINATION ${ICONDIR}/${size}/mimetypes RENAME x-xca-template.png
)
endmacro()
Install_PNG(16x16)
Install_PNG(32x32)
Install_PNG(48x48)
Install_PNG(64x64)
Install_PNG(16x16)
endif()

View File

@ -15,6 +15,12 @@ OpenSSL >= 1.1.0 from https://www.openssl.org
C++11 compiler, e.g. GNU gcc >= 5
GNU make
INSTALL_DIR=/Users/chris/src/xca-dir/install \
cmake -DCMAKE_LIBRARY_PATH="$INSTALL_DIR"/lib \
-DCMAKE_INCLUDE_PATH="$INSTALL_DIR"/include \
-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt\@5/5.15.2/ \
-DCMAKE_BUILD_TYPE=Debug \
../xca
Installation:
=============

View File

@ -1,22 +0,0 @@
Next to the usual configuration script,
there is an alternative way to build xca.
At least on unix, one can use qmake to create a makefile
for building. Maybe this will help, if you have a weired setup.
$ qmake -o makefile
creates the makefile. I recommend "makefile" to not overwrite "Makefile"
and also assures, that it is used instead of the original Makefile.
Now you need to create the file Local.h
$ cat >local.h <<EOF
#define XCA_VERSION "`cat VERSION`"
EOF
or you call ./configure to create it for you.
now just build XCA with
$ make

View File

@ -1,40 +0,0 @@
# WARNING: This file will be overwritten by configure
# @configure_input@
export TOPDIR=@abs_srcdir@
export VERSION=@XCA_VERSION@
export HOST=@HOST@
CPPFLAGS+=-Wall -Wextra -DETC=\"@sysconfdir@\" -DDOCDIR=\"@docdir@\"
CFLAGS+=-O2 -ggdb -std=c++11 @CXXFLAGS@
LIBS=@LIBS@
EXTRA_VERSION=@EXTRA_VERSION@
MOC=@QT_MOC@
UIC=@QT_UIC@
RCC=@QT_RCC@
LRELEASE=@QT_LRELEASE@
LCONVERT=@QT_LCONVERT@
HELPCOLL=@QT_HELPCOLL@
CC=@CXX@
STRIP=@STRIP@
WINDRES=@WINDRES@
DOCTOOL=@DOCTOOL@
MACDEPLOYQT=@MACDEPLOYQT@
SUFFIX=@SUFFIX@
ENABLE_DOC=@ENABLE_DOC@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
QTDIR=@QT_DIR@
INSTALL_DIR=@INSTALL_DIR@
prefix=@prefix@
exec_prefix=@exec_prefix@
docdir=@docdir@
htmldir=@htmldir@
mandir=@mandir@
bindir=@bindir@
datadir=@datadir@
datarootdir=@datarootdir@
xca_prefix=${datarootdir}/${PACKAGE_TARNAME}

121
Makefile
View File

@ -1,36 +1,3 @@
#
# Makefile for XCA
#
#####################################################################
TAG=RELEASE.$(TVERSION)
TARGET=xca-$(TVERSION)
MAKEFLAGS += -rR
export BUILD=$(shell pwd)
ifneq ($(MAKECMDGOALS), distclean)
ifneq ($(MAKECMDGOALS), clean)
ifneq ($(MAKECMDGOALS), dist)
include Local.mak
endif
endif
endif
ifeq ($(TOPDIR),)
TOPDIR=.
endif
VPATH=$(TOPDIR)
SUBDIRS=lib widgets img misc
OBJECTS=$(patsubst %, %/.build-stamp, $(SUBDIRS))
INSTDIR=misc lang doc img
INSTTARGET=$(patsubst %, install.%, $(INSTDIR))
INSTSTAMP=$(patsubst %, %/.install-stamp, $(INSTDIR))
APPTARGET=$(patsubst %, app.%, $(INSTDIR))
DMGSTAGE=$(BUILD)/xca-$(VERSION)
MACTARGET=$(DMGSTAGE)${EXTRA_VERSION}
APPDIR=$(BUILD)/xca.app/Contents
OSSLSIGN=PKCS11SPY=/opt/SimpleSign/libcrypto3PKCS.so /usr/local/bin/osslsigncode
OSSLSIGN_OPT=sign -askpass -certs ~/osdch.crt -askpass \
@ -40,84 +7,12 @@ OSSLSIGN_OPT=sign -askpass -certs ~/osdch.crt -askpass \
-n "XCA $(VERSION)" -i https://hohnstaedt.de/xca \
-t http://timestamp.comodoca.com -h sha2
ifeq ($(SUFFIX), .exe)
all: xca-portable.zip msi-installer-dir.zip
else
ifneq ($(MACDEPLOYQT),)
all: xca.dmg
ifneq ($(APPLE_DEVELOPER),)
APPLE_CERT_ID_APP=Developer ID Application: $(APPLE_DEVELOPER)
APPLE_CERT_3PARTY_INST=3rd Party Mac Developer Installer: $(APPLE_DEVELOPER)
APPLE_CERT_3PARTY_APP=3rd Party Mac Developer Application: $(APPLE_DEVELOPER)
all: xca.pkg
endif
else
all: xca$(SUFFIX) do.doc do.lang
@echo
@echo "Ok, compilation was successful."
@echo "Now do as root: 'make install'"
@echo
endif
endif
ifeq ($(MAKECMDGOALS),)
MAKEFLAGS += -s
export DOCTOOLFLAGS += -q
PRINT=echo
else
PRINT=:
endif
export PRINT
ifneq ($(TOPDIR), $(BUILD))
do.ui: clean_topdir
clean_topdir:
$(MAKE) -C $(TOPDIR) clean
endif
xca$(SUFFIX): $(OBJECTS)
@$(PRINT) " LINK $@"
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(patsubst %,@%, $^) $(LIBS) -o $@
do.ui do.doc do.lang do.misc: do.%:
mkdir -p $*
$(MAKE) -C $* -f $(TOPDIR)/$*/Makefile VPATH=$(TOPDIR)/$* all
headers: do.ui commithash.h
%/.build-stamp: headers
mkdir -p $*
$(MAKE) -C $* -f $(TOPDIR)/$*/Makefile \
VPATH=$(TOPDIR)/$*
%/.install-stamp: %/.build-stamp headers
mkdir -p $*
$(MAKE) -C $* -f $(TOPDIR)/$*/Makefile \
VPATH=$(TOPDIR)/$* .install-stamp
$(INSTTARGET): install.%: %/.build-stamp
mkdir -p $*
$(MAKE) -C $* -f $(TOPDIR)/$*/Makefile \
VPATH=$(TOPDIR)/$* install
$(APPTARGET): app.%: %/.install-stamp
mkdir -p $*
$(MAKE) -C $* -f $(TOPDIR)/$*/Makefile \
VPATH=$(TOPDIR)/$* APPDIR=$(APPDIR) app
clean:
find lib widgets img misc -name "*.o" \
-o -name ".build-stamp" \
-o -name ".depend" \
-o -name "moc_*.cpp" | xargs rm -f
rm -f ui/ui_*.h lang/xca_*.qm doc/*.html doc/xca.1.gz img/imgres.cpp
rm -f lang/*.xml lang/.build-stamp misc/dn.txt misc/eku.txt
rm -f commithash.h misc/oids.txt misc/variables.wxi doc/xca.1
rm -f xca$(SUFFIX) *.dmg xca-portable*.zip msi-installer-dir*.zip xca*.msi
rm -rf xca-$(VERSION)* msi-installer-dir-$(VERSION)* xca-portable-$(VERSION)* doc/html/ doc/qthelp/ doc/sphinx AppStore xca.app
distclean: clean
rm -f local.h Local.mak config.log config.status misc/Info.plist
dist: $(TARGET).tar.gz
$(TARGET).tar:
@ -138,11 +33,6 @@ snapshot:
git archive --format=tar --prefix=xca-$${HASH}/ HEAD | \
gzip -9 > xca-$${HASH}.tar.gz
install: xca$(SUFFIX) $(INSTTARGET)
install -m 755 -d $(DESTDIR)$(bindir)
install -m 755 xca $(DESTDIR)$(bindir)
$(STRIP) $(DESTDIR)$(bindir)/xca
xca$(SUFFIX).signed: xca$(SUFFIX)
%.signed: %
@ -241,14 +131,3 @@ trans:
$(MAKE) -C lang po2ts
lupdate -locations relative $(TOPDIR)/xca.pro
$(MAKE) -C lang xca.pot
.PHONY: $(SUBDIRS) $(INSTDIR) commithash.h xca-portable.zip msi-installer-dir.zip
do.doc do.lang headers: local.h
Local.mak: configure Local.mak.in
$(TOPDIR)/configure
commithash.h:
@$(PRINT) " GEN $@"
$(TOPDIR)/gen_commithash.h.sh $@

View File

@ -1,40 +0,0 @@
include $(BUILD)/Local.mak
export VERSION=$(shell cat $(TOPDIR)/VERSION )
BASENAME=$(shell basename `pwd`)
CPPFLAGS += -I$(TOPDIR) -I$(BUILD) -I$(BUILD)/ui
all: .build-stamp
.build-stamp: $(OBJS)
for i in $(patsubst %, $(shell pwd)/%, $(OBJS)); do echo $$i; done > $@
@$(PRINT) " DONE [$(BASENAME)]"
.install-stamp: .build-stamp
touch $@
SRCS=$(patsubst %.o, %.cpp, $(OBJS))
HEADERS=$(shell ls *.h 2>/dev/null)
GCH=$(patsubst %, %.gch, $(HEADERS))
# how to create a moc_* file
moc_%.cpp: %.h %.cpp
@$(PRINT) " MOC [$(BASENAME)] $@"
$(MOC) $< -o $@
# how to create the headerfile from the *.ui
ui_%.h: %.ui
@$(PRINT) " UIC [$(BASENAME)] $@"
$(UIC) -o $@ $<
# default compile rule
%.o: %.cpp
@$(PRINT) " CC [$(BASENAME)] $@"
$(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
.depend: $(SRCS)
@$(PRINT) " DEP [$(BASENAME)]"
$(CC) -MM $(CPPFLAGS) $(CFLAGS) $^ > $@
.SECONDARY:

View File

@ -1,12 +0,0 @@
#!/bin/sh
if test -n "$1"; then
mkdir -p "$1"
O="$1/"
fi
O="${O}configure"
aclocal -Im4
autoconf -o $O
rm -f aclocal.m4
rm -rf autom4te.cache/

View File

@ -0,0 +1,13 @@
if (SRC AND DST)
file(READ ${SRC} DB_SCHEMA)
string(REPLACE "<<" "" DB_SCHEMA "${DB_SCHEMA}")
string(REPLACE "\\\"" "'" DB_SCHEMA "${DB_SCHEMA}")
string(REPLACE "//" "--" DB_SCHEMA "${DB_SCHEMA}")
string(REPLACE "\"" " " DB_SCHEMA "${DB_SCHEMA}")
string(REGEX REPLACE "^[ \t\r\n]+schemas\\[(.*)\\].*"
" -- Schema Version \\1" DB_SCHEMA "${DB_SCHEMA}")
file(WRITE ${DST} "${DB_SCHEMA}")
else()
message(FATAL_ERROR "Mandatory FILE or SRC variable not defined")
endif()

34
cmake/git_version.cmake Normal file
View File

@ -0,0 +1,34 @@
find_package(Git)
if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
message(STATUS "Git found: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse HEAD
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REV
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(COMMAND git diff-index --quiet HEAD --
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE GIT_LOCAL_CHANGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND git rev-list --count RELEASE.${PROJECT_VERSION}..HEAD
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_COUNTER
RESULT_VARIABLE GIT_COMMIT_COUNTER_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(NOT GIT_COMMIT_COUNTER_RESULT)
string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION})
list(GET VERSION_LIST 0 V_MAJOR)
list(GET VERSION_LIST 1 V_MINOR)
list(GET VERSION_LIST 2 V_PATCH)
math(EXPR V_PATCH "${V_PATCH} + ${GIT_COMMIT_COUNTER}")
set(PROJECT_VERSION "${V_MAJOR}.${V_MINOR}.${V_PATCH}")
message(STATUS "Commit counter: ${GIT_COMMIT_COUNTER} - ${GIT_REV} - ${PROJECT_VERSION}")
endif()
endif()
message(STATUS "VERSION: ${PROJECT_VERSION}")

View File

@ -0,0 +1,77 @@
find_program(SPHINX sphinx-build)
find_program(QTCOLLGEN qcollectiongenerator)
if(SPHINX)
add_custom_command(
OUTPUT html/index.html
COMMAND ${SPHINX} -b html sphinx/rst html
DEPENDS "${PROJECT_BINARY_DIR}/sphinx/rst/conf.py"
sphinx-src sphinx/rst/arguments.rst
COMMENT "Create HTML documentation"
)
add_custom_command(
OUTPUT qthelp/xca.qhcp
COMMAND ${SPHINX} -b qthelp sphinx/rst qthelp
DEPENDS "${PROJECT_BINARY_DIR}/sphinx/rst/conf.py"
sphinx-src sphinx/rst/arguments.rst
COMMENT "Create context sensitive help"
)
add_custom_command(
OUTPUT qthelp/xca.qhc
COMMAND ${QTCOLLGEN} -o "${PROJECT_BINARY_DIR}/qthelp/xca.qhc"
"${PROJECT_BINARY_DIR}/qthelp/xca.qhcp"
DEPENDS "${PROJECT_BINARY_DIR}/qthelp/xca.qhcp"
COMMENT "Create context sensitive help index"
)
add_custom_command(
OUTPUT sphinx/rst/database_schema.sql
COMMAND ${CMAKE_COMMAND} -E make_directory sphinx/rst/_static
COMMAND ${CMAKE_COMMAND}
-D "SRC=${PROJECT_SOURCE_DIR}/widgets/database_schema.cpp"
-D "DST=sphinx/rst/database_schema.sql"
-P "${PROJECT_SOURCE_DIR}/cmake/database_schema.cmake"
DEPENDS widgets/database_schema.cpp
COMMENT "Generating database schema SQL documentation"
)
add_custom_command(
OUTPUT sphinx/rst/COPYRIGHT sphinx/rst/changelog
sphinx/rst/_static/bigcert.png sphinx/rst
COMMAND ${CMAKE_COMMAND} -E make_directory sphinx/rst/_static
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${PROJECT_SOURCE_DIR}/doc/rst" sphinx/rst
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/COPYRIGHT"
"${PROJECT_SOURCE_DIR}/changelog"
sphinx/rst
DEPENDS COPYRIGHT changelog doc/rst
COMMENT "Prepare Sphinx source directory"
)
add_custom_command(
OUTPUT sphinx/rst/arguments.rst
COMMAND xcadoc rst sphinx/rst/arguments.rst
)
add_custom_target(sphinx-html DEPENDS html/index.html)
add_custom_target(sphinx-qthelp ALL DEPENDS qthelp/xca.qhc)
add_custom_target(sphinx DEPENDS sphinx-html sphinx-qthelp)
add_custom_target(sphinx-src
DEPENDS sphinx/rst/COPYRIGHT sphinx/rst/changelog
sphinx/rst/_static/bigcert.png sphinx/rst
sphinx/rst/database_schema.sql
)
else()
add_custom_target(sphinx-qthelp)
endif()
if (NOT WIN32)
add_custom_command(
OUTPUT xca.1.gz
COMMAND sh -c 'cd ${PROJECT_SOURCE_DIR}/doc && cat xca.1.head "${PROJECT_BINARY_DIR}/xca.1.options" xca.1.tail | gzip > ${PROJECT_BINARY_DIR}/xca.1.gz'
DEPENDS doc/xca.1.head ${PROJECT_BINARY_DIR}/xca.1.options doc/xca.1.tail
)
add_custom_command(
OUTPUT xca.1.options
COMMAND xcadoc man xca.1.options
)
add_custom_target(manpage ALL DEPENDS xca.1.gz)
endif()

View File

@ -0,0 +1,20 @@
if (FILE AND SRC)
set(TEXT_PREFIX "# Do not edit this file, rather use:")
if (APPLE)
set(DIR_HINT "HOME/Library/Application Support/data/xca/${FILE}.txt")
elseif (WIN32)
set(DIR_HINT "PROFILE\Application Data\xca\${FILE}.txt")
else()
set(DIR_HINT "/usr/local/share/xca/${FILE}.txt or HOME/.local/share/xca/${FILE}.txt")
endif()
file(READ "${SRC}/misc/${FILE}.text" CONT)
file(WRITE "misc/${FILE}.txt"
${TEXT_PREFIX} "\n# "
${DIR_HINT} "\n"
${CONT})
else()
message(FATAL_ERROR "Mandatory FILE or SRC variable not defined")
endif()

View File

@ -1,314 +0,0 @@
AC_INIT([X Certificate and Key management],
m4_esyscmd([tr -d '\n' < VERSION]),
[christian@hohnstaedt.de],
[xca],
[http://xca.hohnstaedt.de])
ITERATION="$(cd "$srcdir" && git rev-list --count RELEASE.${PACKAGE_VERSION}..HEAD)"
XCA_VERSION=$(IFS='.'; set - $PACKAGE_VERSION; echo $1.$2.$(($ITERATION+$3)))
AC_MSG_NOTICE([ ***************************************************])
AC_MSG_NOTICE([ * ${PACKAGE_NAME} ${XCA_VERSION}])
AC_MSG_NOTICE([ ***************************************************])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CXX
AC_LANG(C++)
AC_CHECK_TOOL(STRIP, [strip], [:])
AC_CHECK_TOOL(WINDRES, [windres], [:])
VERSIONHASH="$(echo "${XCA_VERSION}" | shasum | cut -b -12)"
AC_SUBST([VERSIONHASH])
AC_SUBST([XCA_VERSION])
AC_DEFINE_UNQUOTED([XCA_VERSION], [ "${XCA_VERSION}" ],
[ XCA Version string with calculated patch level])
AC_ARG_WITH([macos-version],
AS_HELP_STRING([--with-macos-version], [Select macOS minimum SDK version]),
[ MACOS_VERSION="$withval"
CXXFLAGS="${CXXFLAGS} -mmacosx-version-min=$MACOS_VERSION"
case "$withval" in
10.10) EXTRA_VERSION=-Yosemite ;;
10.11) EXTRA_VERSION=-El-Capitan ;;
10.12) EXTRA_VERSION=-Sierra ;;
10.13) EXTRA_VERSION=-High-Sierra ;;
10.14) EXTRA_VERSION=-Mojave ;;
10.15) EXTRA_VERSION=-Catalina ;;
11.00) EXTRA_VERSION=-Big-Sur ;;
*) echo "Unknown macOS Version $withval"
exit 1 ;;
esac
MACOS_VERSION3="${MACOS_VERSION}.0"
]
)
AC_SUBST([EXTRA_VERSION])
AC_SUBST([MACOS_VERSION])
AC_SUBST([MACOS_VERSION3])
if test -d "$INSTALL_DIR"; then
AC_MSG_NOTICE([Using INSTALL_DIR $INSTALL_DIR])
test -d "${INSTALL_DIR}/include" && CXXFLAGS="${CXXFLAGS} -I${INSTALL_DIR}/include"
test -d "${INSTALL_DIR}/lib" && LIBS="${LIBS} -L${INSTALL_DIR}/lib"
fi
case "$(${CXX} -dumpmachine)" in
*apple-darwin*)
HOST=DARWIN
CXXFLAGS="${CXXFLAGS} -pipe -gdwarf-2"
LIBS="${LIBS} -framework IOKit -framework CoreFoundation"
BREW_PREFIX="$(brew --prefix)"
if test "$BREW_PREFIX"; then
PKG_CONFIG_PATH="$(find ${BREW_PREFIX}/Cellar -name 'pkgconfig' -type d | tr '\n' ':')${PKG_CONFIG_PATH}"
CXXFLAGS="${CFLAGS} -I${BREW_PREFIX}/include"
LIBS="${LIBS} -L${BREW_PREFIX}/lib"
fi
export DYLD_LIBRARY_PATH
test "${MACOS_VERSION3}" || MACOS_VERSION3="$(sw_vers -productVersion)"
;;
*mingw*)
HOST=WINDOWS
SUFFIX=".exe"
PKG_CONFIG="$(which pkg-config) --define-prefix"
PKG_CONFIG_LIBDIR=""
CXXFLAGS="${CXXFLAGS} -mthreads -mwindows -mnop-fun-dllimport -Wno-strict-aliasing"
LIBS="${LIBS} -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -static-libgcc"
;;
*linux*)
HOST=LINUX
;;
*)
HOST=UNIX
;;
esac
AC_MSG_NOTICE([Compiling for host: $HOST])
AC_SUBST([HOST])
AC_SUBST([MACDEPLOYQT])
AC_SUBST([SUFFIX])
AC_SUBST([INSTALL_DIR])
export PKG_CONFIG_PATH
export LD_LIBRARY_PATH
if test "$srcdir" != "."; then
exist=""
for f in Local.mak local.h commithash.h; do
test ! -r "$srcdir"/"$f" || exist="$exist $f"
done
if test -n "$exist"; then
AC_ERROR([The source directory (${srcdir}) contains the file(s):$exist.
They must be removed before building here.])
fi
fi
# Detect the OpenSSL libraries and header
#########################################
AC_ARG_WITH([openssl],
AS_HELP_STRING([--with-openssl], [Select the OpenSSL installation directory]),
[ if test -d "$withval"; then
_OPENSSLDIR="$withval"
else
AC_MSG_WARN([OpenSSL directory '$withval' does not exist or is not a directory])
fi
], [_OPENSSLDIR="$OPENSSLDIR"])
if test -n "${_OPENSSLDIR}" && test -d "${_OPENSSLDIR}"; then
_OPENSSLDIR=`cd ${_OPENSSLDIR} && pwd`
PKG_CONFIG_PATH="${_OPENSSLDIR}/lib/pkgconfig:${PKG_CONFIG_PATH}"
LD_LIBRARY_PATH="${_OPENSSLDIR}/lib:${LD_LIBRARY_PATH}"
DYLD_LIBRARY_PATH="${_OPENSSLDIR}/lib:${DYLD_LIBRARY_PATH}"
fi
PKG_CHECK_MODULES([OpenSSL],
[libcrypto >= 1.1.0], [ ],
[
OpenSSL_LIBS=" -lcrypto ";
AC_MSG_WARN([OpenSSL pkg-config failed, using fallback defaults (${OpenSSL_LIBS})]);
]
)
OPENSSL_LIBS="$OpenSSL_LIBS"
OPENSSL_CFLAGS="$OpenSSL_CFLAGS"
# Detect the Qt libraries and header
####################################
AC_ARG_WITH([qt],
AS_HELP_STRING([--with-qt], [Select the Qt installation directory]),
[ if test -d "$withval"; then
_QTDIR="$withval"
else
AC_MSG_WARN([Qt directory '$withval' does not exist or is not a directory])
fi
], [_QTDIR="${QTDIR}"])
if test -n "${_QTDIR}" && test -d "${_QTDIR}"; then
_QTDIR=`cd ${_QTDIR} && pwd`
PKG_CONFIG_PATH="${_QTDIR}/lib/pkgconfig:${PKG_CONFIG_PATH}"
LD_LIBRARY_PATH="${_QTDIR}/lib:${LD_LIBRARY_PATH}"
DYLD_LIBRARY_PATH="${_QTDIR}/lib:${DYLD_LIBRARY_PATH}"
fi
AC_ARG_WITH([qt-version],
AS_HELP_STRING([--with-qt-version],
[Select the Qt version: 5 or 6 if both are installed]),
[WANT_QT_VERSION="$withval"],
[WANT_QT_VERSION=detect])
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 5; then
PKG_CHECK_MODULES(Qt5, [Qt5Core Qt5Widgets Qt5Sql Qt5Help], [
_QT_HOST_BINS="`pkg-config --variable=host_bins Qt5Core`"
QT_MOC="${_QT_HOST_BINS}/moc"
QT_UIC="${_QT_HOST_BINS}/uic"
if test "$HOST" = "DARWIN"; then
FRAMEDIR=`pkg-config --variable=libdir Qt5Core`
Qt5_CFLAGS="$Qt5_CFLAGS -std=c++11 -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtWdgets.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers"
Qt5_LDFLAGS=" -Xlinker -rpath -Xlinker ${FRAMEDIR}"
fi
WANT_QT_VERSION=5
QT_VERSION=5
QT_CFLAGS="${Qt5_CFLAGS} -fPIC"
QT_LIBS="${Qt5_LIBS}${Qt5_LDFLAGS}"
],[ : ])
fi
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 6; then
PKG_CHECK_MODULES(Qt6, [Qt6Core Qt6Gui Qt6Sql Qt6Help], [
QT_MOC="`pkg-config --variable=moc_location QtCore`"
QT_UIC="`pkg-config --variable=uic_location QtCore`"
if test -n "${QT_MOC}"; then
_QT_HOST_BINS="`dirname ${QT_MOC}`"
fi
if test "$HOST" = "DARWIN"; then
FRAMEDIR=`pkg-config --variable=libdir QtCore`
Qt6_CFLAGS="$Qt4_CFLAGS -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers"
Qt6_LDFLAGS=" -Xlinker -rpath -Xlinker ${FRAMEDIR}"
fi
WANT_QT_VERSION=6
QT_VERSION=6
QT_CFLAGS="${Qt6_CFLAGS}"
QT_LIBS="${Qt6_LIBS}${Qt6_LDFLAGS}"
],[ : ])
fi
if test -z "${QT_VERSION}"; then
if test -z "$DARWIN"; then
QT_LIBS=" -lQtCore -lQtGui "
else
_QT_HOST_BINS="${_QTDIR}/bin"
QT_MOC="${_QT_HOST_BINS}/moc"
QT_UIC="${_QT_HOST_BINS}/uic"
FRAMEDIR=${_QTDIR}/lib
QT_LIBS=" -framework QtGui -framework QtCore -framework QtWidgets -framework QtSql -Xlinker -rpath -Xlinker ${FRAMEDIR}"
QT_CFLAGS="-std=c++11 -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtWidgets.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers"
fi
AC_MSG_WARN([Qt pkg-config failed, using fallback defaults (${QT_LIBS})]);
fi
QT_DIR="$_QTDIR"
# Delete trailing d (Debug) from Qt libs (@<:@ == [) (@:>@ == ])
QT_LIBS="$(echo " $QT_LIBS " | sed 's/-lQt\(@<:@^ @:>@*\)d\s/-lQt\1 /g')"
AC_SUBST([QT_CFLAGS])
AC_SUBST([QT_LIBS])
AC_SUBST([QT_DIR])
# Setup MOC UIC RCC LRELEASE LCONVERT with absolute PATH
if test ! -x "${QT_MOC}"; then
QT_MOC="`which moc-qt${QT_VERSION} || which moc`"
fi
if test ! -x "${QT_UIC}"; then
QT_UIC="`which uic-qt${QT_VERSION} || which uic`"
fi
QT_BIN_PATH="${_QT_HOST_BINS}:$PATH"
AC_PATH_PROG([QT_LRELEASEQT], [lrelease-qt${QT_VERSION}], , [$QT_BIN_PATH])
if test "x${QT_LRELEASEQT}" = "x"; then
AC_PATH_PROG([QT_LRELEASE], [lrelease], [lrelease], [$QT_BIN_PATH])
else
QT_LRELEASE="$QT_LRELEASEQT"
fi
AC_PATH_PROG([QT_LCONVERTQT], [lconvert-qt${QT_VERSION}], , [$QT_BIN_PATH])
if test "x${QT_LCONVERTQT}" = "x"; then
AC_PATH_PROG([QT_LCONVERT], [lconvert], [lconvert], [$QT_BIN_PATH])
else
QT_LCONVERT="$QT_LCONVERTQT"
fi
AC_PATH_PROG([QT_RCCQT], [rcc-qt${QT_VERSION}], , [$QT_BIN_PATH])
if test "x${QT_RCCQT}" = "x"; then
AC_PATH_PROG([QT_RCC], [rcc], [rcc], [$QT_BIN_PATH])
else
QT_RCC="$QT_RCCQT"
fi
AC_PATH_PROG([QT_HELPCOLL], [qcollectiongenerator${QT_VERSION}], , [$QT_BIN_PATH])
if test "x${QT_HELPCOLL}" = "x"; then
AC_PATH_PROG([QT_HELPCOLL], [qcollectiongenerator], [qcollectiongenerator], [$QT_BIN_PATH])
else
QT_HELPCOLL="$QT_HELPCOLL"
fi
if test "$HOST" = "DARWIN"; then
AC_PATH_PROG([MACDEPLOYQT], [macdeployqt], [macdeployqt], [$QT_BIN_PATH])
fi
AC_SUBST([QT_MOC])
AC_SUBST([QT_UIC])
AC_SUBST([QT_LRELEASE])
AC_SUBST([QT_LCONVERT])
AC_SUBST([QT_RCC])
# The dyn_loader library libltdl
##################################
AC_CHECK_LIB(ltdl, lt_dlopen, , [
echo "ERROR: Library 'ltdl' with symbol 'lt_dlopen' not found."
echo " Try installing the package 'libltdl-dev' or 'libtool'"
exit 1
])
AC_CHECK_HEADER(ltdl.h, , [
echo "ERROR: Header 'ltdl.h' not found."
echo " Try installing the package 'libltdl-dev' or 'libtool'"
exit 1
])
# Finally collect the compiler flags
#####################################
CXXFLAGS="${OPENSSL_CFLAGS} ${QT_CFLAGS} ${CXXFLAGS}"
LIBS="${OPENSSL_LIBS} ${QT_LIBS} -lstdc++ ${LIBS}"
# Just give it a try .....
##########################
XCA_COMPILE_TEST()
AX_CHECK_GNU_MAKE()
# linuxdoc application detection
##################################
AC_CHECK_PROGS([DOCTOOL], [sphinx-build])
AC_SUBST([DOCTOOL])
AC_ARG_ENABLE([doc],
AS_HELP_STRING([--disable-doc], [Disable documentation installation]),
,
[enable_doc=yes])
if test "${enable_doc}" = "yes" &&
test "${DOCTOOL}" &&
test "${QT_HELPCOLL}"
then
ENABLE_DOC=
else
ENABLE_DOC='\#'
fi
AC_SUBST([ENABLE_DOC])
# Setup done. Write local.h and Local.mak
############################################
AC_CONFIG_HEADERS(local.h)
AC_CONFIG_LINKS(Makefile:Makefile)
AC_CONFIG_FILES([Local.mak misc/Info.plist misc/variables.wxi doc/conf.py])
AC_OUTPUT

View File

@ -1,71 +0,0 @@
ifeq ($(TOPDIR),)
TOPDIR=..
BUILD=..
endif
DELFILES=xca*.html xca.1.gz conf.py
RST_FILES=arguments common-actions object-ids smartcard \
certificate-input database options step-by-step \
certificates index privatekey template changelog \
introduction requests commandline miscellaneous \
revocationlist
SPHINX_FILES=$(patsubst %,sphinx/%.rst,$(RST_FILES))
.build-stamp doc: xca.1.gz html/index.html qthelp/xca.qhc changelog.html
qthelpfiles=qthelp/*.html qthelp/xca.qhc qthelp/xca.qch
.install-stamp: doc
include $(TOPDIR)/Rules.mak
%.1.gz: %.1
@$(PRINT) " MAN [$(BASENAME)] $@"
gzip -9 <$^ >$@
xca.1: xca.1.head xca.1.options xca.1.tail
cat $^ > $@
html/index.html: sphinx/conf.py
@$(PRINT) " HTML [$(BASENAME)] $@"
$(ENABLE_DOC)$(DOCTOOL) -b html $(DOCTOOLFLAGS) sphinx html
mkdir -p html && touch $@
qthelp/xca.qhcp: sphinx/conf.py
@$(PRINT) " QTHELP [$(BASENAME)] $@"
$(ENABLE_DOC)$(DOCTOOL) -b qthelp $(DOCTOOLFLAGS) sphinx qthelp
mkdir -p qthelp && touch $@
qthelp/xca.qhc: qthelp/xca.qhcp
@$(PRINT) " QTHGEN [$(BASENAME)] $@"
$(ENABLE_DOC)$(HELPCOLL) $< -o $@
install: $(doc)
$(ENABLE_DOC)install -m 755 -d $(DESTDIR)$(htmldir)
$(ENABLE_DOC)install -m 644 $(qthelpfiles) $(DESTDIR)$(htmldir)
install -m 755 -d $(DESTDIR)$(mandir)/man1
install -m 644 *.1.gz $(DESTDIR)/$(mandir)/man1
app: $(doc)
mkdir -p $(APPDIR)/Resources
$(ENABLE_DOC)install -m 644 $(qthelpfiles) $(APPDIR)/Resources
sphinx/conf.py: conf.py sphinx/database_schema.sql sphinx/changelog sphinx/COPYRIGHT sphinx/_static/bigcert.png $(SPHINX_FILES)
mkdir -p sphinx
cp $< $@
sphinx/database_schema.sql: ../widgets/database_schema.cpp
mkdir -p sphinx
sed 's/<<//; s/\\"/'"'"'/g; s,//,--,; s/"/ /g; s/^[[:space:]]\+schemas\[\(.*\)\].*/ -- Schema Version \1/; /^\t$$/d' < $^ > $@
sphinx/changelog: ../changelog
mkdir -p sphinx
cp $^ $@
sphinx/COPYRIGHT: ../COPYRIGHT
@mkdir -p sphinx
cp $^ $@
sphinx/_static/bigcert.png: ../img/bigcert.png
@mkdir -p sphinx/_static
cp $^ $@
sphinx/%.rst: rst/%.rst
@mkdir -p sphinx
cp $^ $@
changelog.html: ../changelog
sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s#^xca \([^ ]*\) *\(.*\)#</ul></div><div id="changelog_\1"><h3>xca \1 \2</h3><ul>#; s#\*\(.*\)#</li><li>\1#' $^ >$@

View File

@ -17,7 +17,7 @@
# -- Project information -----------------------------------------------------
project = '@PACKAGE_TARNAME@'
project = '@PROJECT_NAME@'
copyright = '2021, Christian Hohnstädt'
author = 'Christian Hohnstädt'

View File

@ -1,42 +0,0 @@
..
Automatically created by
XCA_SPECIAL=rst ./xca > doc/rst/arguments.rst
--crlgen=ca-identifier Generate CRL for <ca>. Use the \'name\' option to set the internal name of the new CRL. [#need-db]_
--database=database File name (\*.xdb) of the SQLite database or a remote database descriptor\: [user\@host/TYPE\:dbname#prefix].
--exit Exit after importing items.
--help Print this help and exit.
--hierarchy=directory Save OpenSSL index hierarchy in <dir>. [#need-db]_
--index=file Save OpenSSL index in <file>. [#need-db]_
--import Import all provided items into the database. [#need-db]_
--issuers Print all known issuer certificates that have an associated private key and the CA basic constraints set to \'true\'. [#need-db]_
--keygen=type Generate a new key and import it into the database. Use the \'name\' option to set the internal name of the new key. The <type> parameter has the format\: \'[RSA|DSA|EC]\:[<size>|<curve>]. [#need-db]_
--list-curves Prints all known Elliptic Curves.
--name=internal-name Provides the name of new generated items. An automatic name will be generated if omitted. [#need-db]_
--no-gui Do not start the GUI. Alternatively set environment variable XCA\_NO\_GUI=1 or call xca as \'xca-console\' symlink.
--password=password Database password for unlocking the database.
--pem Print PEM representation of provided files. Prints only the public part of private keys.
--print Print a synopsis of provided files.
--sqlpass=password Password to access the remote SQL server.
--text Print the content of provided files as OpenSSL does.
--verbose Print debug log on stderr. Alternatively set the environment variable XCA\_DEBUG=1.
--version Print version information and exit.
.. [#need-db] Requires a database. Either from the commandline or as default database.
Passphrase arguments
.....................
The password options accept the same syntax as openssl does:
env\:var
Obtain the password from the environment variable var. Since the environment of other processes is visible on certain platforms (e.g. ps under certain Unix OSes) this option should be used with caution.
fd\:number
Read the password from the file descriptor number. This can be used to send the data via a pipe for example.
file\:pathname
The first line of pathname is the password. If the same pathname argument is supplied to password and sqlpassword arguments then the first line will be used for both passwords. pathname need not refer to a regular file\: it could for example refer to a device or named pipe.
pass\:password
The actual password is password. Since the password is visible to utilities (like \'ps\' under Unix) this form should only be used where security is not important.
stdin
Read the password from standard input.

View File

@ -1,79 +0,0 @@
.TP
.B \-\-crlgen=<ca-identifier> *
Generate CRL for <ca>. Use the 'name' option to set the internal name of the new CRL.
.TP
.B \-\-database=<database>
File name (*.xdb) of the SQLite database or a remote database descriptor: [user@host/TYPE:dbname#prefix].
.TP
.B \-\-exit
Exit after importing items.
.TP
.B \-\-help
Print this help and exit.
.TP
.B \-\-hierarchy=<directory> *
Save OpenSSL index hierarchy in <dir>.
.TP
.B \-\-index=<file> *
Save OpenSSL index in <file>.
.TP
.B \-\-import *
Import all provided items into the database.
.TP
.B \-\-issuers *
Print all known issuer certificates that have an associated private key and the CA basic constraints set to 'true'.
.TP
.B \-\-keygen=<type> *
Generate a new key and import it into the database. Use the 'name' option to set the internal name of the new key. The <type> parameter has the format: '[RSA|DSA|EC]:[<size>|<curve>].
.TP
.B \-\-list-curves
Prints all known Elliptic Curves.
.TP
.B \-\-name=<internal-name> *
Provides the name of new generated items. An automatic name will be generated if omitted.
.TP
.B \-\-no-gui
Do not start the GUI. Alternatively set environment variable XCA_NO_GUI=1 or call xca as 'xca-console' symlink.
.TP
.B \-\-password=<password>
Database password for unlocking the database.
.TP
.B \-\-pem
Print PEM representation of provided files. Prints only the public part of private keys.
.TP
.B \-\-print
Print a synopsis of provided files.
.TP
.B \-\-sqlpass=<password>
Password to access the remote SQL server.
.TP
.B \-\-text
Print the content of provided files as OpenSSL does.
.TP
.B \-\-verbose
Print debug log on stderr. Alternatively set the environment variable XCA_DEBUG=1.
.TP
.B \-\-version
Print version information and exit.
.br
.TP
Options marked with an asterisk need a database. Either from the commandline or as default database.
.SH PASS PHRASE ARGUMENTS
The password options accept the same syntax as openssl does:
.TP
.B env:var
Obtain the password from the environment variable var. Since the environment of other processes is visible on certain platforms (e.g. ps under certain Unix OSes) this option should be used with caution.
.TP
.B fd:number
Read the password from the file descriptor number. This can be used to send the data via a pipe for example.
.TP
.B file:pathname
The first line of pathname is the password. If the same pathname argument is supplied to password and sqlpassword arguments then the first line will be used for both passwords. pathname need not refer to a regular file: it could for example refer to a device or named pipe.
.TP
.B pass:password
The actual password is password. Since the password is visible to utilities (like 'ps' under Unix) this form should only be used where security is not important.
.TP
.B stdin
Read the password from standard input.

View File

@ -1,15 +0,0 @@
#!/bin/sh
(
cd `dirname $0`
echo '#define COMMITHASH "'
git rev-parse HEAD
git diff-index --quiet HEAD -- || test ! -d .git || echo "+local-changes"
echo '"'
) 2>/dev/null | tr -d '\n' > "$1.new"
if cmp -s "$1" "$1.new"; then
rm -f "$1.new"
else
mv "$1.new" "$1"
fi

View File

@ -1,38 +0,0 @@
ifeq ($(TOPDIR),)
TOPDIR=..
BUILD=..
endif
include $(TOPDIR)/Rules.mak
PO_LANGUAGES=tr fr sk
LANGUAGES=de ru hr pl pt_BR es it zh_CN nl ja $(PO_LANGUAGES)
QM_XCA=$(patsubst %, xca_%.qm, $(LANGUAGES))
QM_QT=$(patsubst %, qt_%.qm, $(LANGUAGES))
TS_XCA=$(patsubst %, xca_%.ts, $(PO_LANGUAGES))
.install-stamp lang all: $(QM_XCA)
%.qm: %.ts
@$(PRINT) " LANG [$(BASENAME)] $@"
$(LRELEASE) -silent $< -qm $@
install: $(QM_XCA)
install -m 755 -d $(DESTDIR)$(xca_prefix)
install -m 644 $(QM_XCA) $(DESTDIR)$(xca_prefix)
app:
mkdir -p $(APPDIR)/Resources
install -m 644 $(QM_XCA) $(APPDIR)/Resources
cd $(TRANSLATIONS) && \
for x in $(QM_QT); do \
test -f "$$x" && install $$x $(APPDIR)/Resources;\
done || :
po2ts: $(TS_XCA)
xca_%.ts: %.po
$(LCONVERT) -if po -i $< -of ts -o $(@)
xca.pot: xca.ts
$(LCONVERT) -if ts -of po -i $< -o $@

View File

@ -1,15 +0,0 @@
<?xml version="1.0"?>
<!--
Remove all whitespace and propely indent the TS files
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

43
lib/CMakeLists.txt Normal file
View File

@ -0,0 +1,43 @@
include_directories(${Qt5Sql_INCLUDE_DIRS}
${Qt5Core_INCLUDE_DIRS}
${Qt5Help_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${LTDL_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}
)
add_library(core STATIC
BioByteArray.cpp dbhistory.cpp pki_key.cpp
BioByteArray.h dbhistory.h pki_key.h
Passwd.cpp entropy.cpp pki_lookup.h
Passwd.h entropy.h pki_multi.cpp
arguments.cpp exception.h pki_multi.h
arguments.h func.cpp pki_pkcs12.cpp
asn1int.cpp func.h pki_pkcs12.h
asn1int.h headerlist.h pki_pkcs7.cpp
asn1time.cpp ipvalidator.h pki_pkcs7.h
asn1time.h load_obj.cpp pki_scard.cpp
base.h load_obj.h pki_scard.h
builtin_curves.cpp main.cpp pki_temp.cpp
builtin_curves.h main.h pki_temp.h
database_model.cpp oid.cpp pki_x509.cpp
database_model.h oid.h pki_x509.h
db_base.cpp opensc-pkcs11.h pki_x509req.cpp
db_base.h openssl_compat.h pki_x509req.h
db_crl.cpp pass_info.cpp pki_x509super.cpp
db_crl.h pass_info.h pki_x509super.h
db_key.cpp pk11_attribute.cpp settings.cpp
db_key.h pk11_attribute.h settings.h
db_temp.cpp pkcs11.cpp sql.cpp
db_temp.h pkcs11.h sql.h
db_token.cpp pkcs11_lib.cpp version.cpp
db_token.h pkcs11_lib.h x509name.cpp
db_x509.cpp pki_base.cpp x509name.h
db_x509.h pki_base.h x509rev.cpp
db_x509req.cpp pki_crl.cpp x509rev.h
db_x509req.h pki_crl.h x509v3ext.cpp
db_x509super.cpp pki_evp.cpp x509v3ext.h
db_x509super.h pki_evp.h xfile.h
dhgen.cpp dhgen.h XcaProgress.cpp
XcaProgress.h
)

View File

@ -1,19 +0,0 @@
ifeq ($(TOPDIR),)
TOPDIR=..
BUILD=..
endif
MOCNAMES=db_crl db_key db_temp db_x509 db_x509req db_x509super db_base db_token\
pki_temp pki_x509 pki_crl pki_x509req pki_key pki_x509super pki_pkcs12 \
pki_base pki_multi pki_evp pki_scard pass_info pki_pkcs7 database_model
NAMES=$(MOCNAMES) asn1int oid x509rev asn1time version \
x509v3ext func load_obj x509name settings \
pk11_attribute pkcs11 pkcs11_lib Passwd builtin_curves entropy sql \
dbhistory main arguments BioByteArray
OBJS=$(patsubst %, %.o, $(NAMES)) $(patsubst %, moc_%.o, $(MOCNAMES))
include $(TOPDIR)/Rules.mak
sinclude .depend

View File

@ -14,8 +14,6 @@
#include <QStringList>
#include <QMap>
#include "func.h"
struct option;
#define file_argument (required_argument+1)

View File

@ -16,17 +16,9 @@
#endif
#include <qglobal.h>
#include <openssl/opensslv.h>
#ifndef QMAKE
#include "local.h"
#else
#define PREFIX "/usr/local"
#define ETC "/etc"
#define DOCDIR "/usr/local/doc/xca"
#endif
#define CCHAR(x) qPrintable(x)
#endif
#define C_FILE ((strrchr(__FILE__, '/') ? : __FILE__- 1) + 1)
#define TRACE qDebug("File: %s Func: %s Line: %d", C_FILE, __func__, __LINE__);
@ -45,3 +37,5 @@
#else
# error "What kind of system is this?"
#endif
#endif

View File

@ -17,11 +17,14 @@
#include <QFileDialog>
#include <QFileInfo>
#include "widgets/XcaWarning.h"
#include "widgets/MainWindow.h"
#include "widgets/XcaApplication.h"
#include "widgets/ImportMulti.h"
#include "widgets/XcaDialog.h"
#warning drop UI dependencies
#include "ui_ItemProperties.h"
#include "ui_ImportMulti.h"
#include "ui_XcaDialog.h"
void db_base::restart_timer()
{

View File

@ -11,7 +11,7 @@
#include <typeinfo>
#include "base.h"
#include "load_obj.h"
#include "widgets/ExportDialog.h"
#include "exportType.h"
#include "pki_base.h"
#include "headerlist.h"

View File

@ -14,6 +14,8 @@
#include <QMessageBox>
#include <QContextMenuEvent>
#include "widgets/ItemCombo.h"
#include "widgets/ExportDialog.h"
#include "ui_ExportDialog.h"
db_crl::db_crl() : db_x509name("crls")
{

View File

@ -8,6 +8,7 @@
#ifndef __DB_KEY_H
#define __DB_KEY_H
#include "exportType.h"
#include "db_base.h"
#include "pki_key.h"

View File

@ -10,6 +10,7 @@
#include "func.h"
#include "widgets/XcaWarning.h"
#include "widgets/NewX509.h"
#include "ui_NewX509.h"
#include <QFileDialog>
#include <QDir>
#include <QContextMenuEvent>

View File

@ -26,6 +26,11 @@
#include "widgets/NewX509.h"
#include "widgets/Help.h"
#include "ui_RevocationList.h"
#include "ui_CertExtend.h"
#include "ui_Revoke.h"
#include "ui_Help.h"
#include <QMessageBox>
#include <QContextMenuEvent>
#include <QAction>

View File

@ -9,6 +9,7 @@
#ifndef __DB_X509_H
#define __DB_X509_H
#include "exportType.h"
#include "db_x509super.h"
#include "asn1int.h"
#include "x509rev.h"

View File

@ -11,7 +11,7 @@
#include "pki_temp.h"
#include "widgets/NewX509.h"
#include "widgets/XcaWarning.h"
#include "widgets/ExportDialog.h"
db_x509req::db_x509req() : db_x509super("requests")
{

View File

@ -16,6 +16,8 @@
#include "widgets/XcaDialog.h"
#include "widgets/XcaWarning.h"
#include "ui_CertDetail.h"
#include <QFileDialog>
#include <QFileInfo>

52
lib/exportType.h Normal file
View File

@ -0,0 +1,52 @@
/* vi: set sw=4 ts=4:
*
* Copyright (C) 2021 Christian Hohnstaedt.
*
* All rights reserved.
*/
#ifndef __EXPORTTYPE_H
#define __EXPORTTYPE_H
#include <QMetaType>
#include <QString>
class exportType {
public:
enum etype { Separator, PEM, PEM_chain, PEM_unrevoked, PEM_all,
DER, PKCS7, PKCS7_chain, PKCS7_unrevoked, PKCS7_all,
PKCS12, PKCS12_chain, PEM_cert_key, PEM_cert_pk8,
PEM_key, PEM_private, PEM_private_encrypt, DER_private,
DER_key, PKCS8, PKCS8_encrypt, SSH2_public,
PEM_selected, PKCS7_selected, Index, vcalendar, vcalendar_ca,
PVK_private, PVK_encrypt, SSH2_private, ETYPE_max };
enum etype type;
QString extension;
QString desc;
exportType(enum etype t, const QString &e, const QString &d)
: type(t), extension(e), desc(d)
{
}
exportType() : type(Separator) { }
bool isPEM() const {
switch (type) {
case PEM:
case PEM_chain:
case PEM_unrevoked:
case PEM_all:
case PEM_cert_key:
case PEM_cert_pk8:
case PEM_key:
case PEM_private:
case PEM_private_encrypt:
case PEM_selected:
case SSH2_private:
return true;
default:
return false;
}
}
};
Q_DECLARE_METATYPE(exportType);
#endif

View File

@ -13,6 +13,7 @@
#include "lib/settings.h"
#include "widgets/validity.h"
#include "widgets/XcaWarning.h"
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/sha.h>
#include <openssl/asn1.h>

View File

@ -8,18 +8,13 @@
#ifndef __FUNC_H
#define __FUNC_H
#include <QPixmap>
#include <QByteArray>
#include <QMap>
#include <QTextDocument>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <openssl/evp.h>
#include <openssl/asn1.h>
#include "base.h"
#include "Passwd.h"
@ -38,8 +33,13 @@
class Validity;
class MainWindow;
class QPixmap;
extern MainWindow *mainwin;
typedef struct asn1_object_st ASN1_OBJECT;
typedef struct asn1_string_st ASN1_STRING;
typedef struct evp_md_st EVP_MD;
int console_write(FILE *fp, const QByteArray &ba);
Passwd readPass();
QPixmap *loadImg(const char *name);

View File

@ -10,8 +10,8 @@
#include "pki_x509super.h"
#include "func.h"
#include "pkcs11.h"
#include "exportType.h"
#include "widgets/XcaWarning.h"
#include "widgets/ExportDialog.h"
#include <openssl/rand.h>
#include <openssl/pem.h>

View File

@ -19,6 +19,8 @@
#include <openssl/pkcs12.h>
#include <openssl/stack.h>
#warning split PwDialog into console and GUI
#include "ui_PwDialog.h"
#include <QMessageBox>
pki_pkcs12::pki_pkcs12(const QString &d, pki_x509 *acert, pki_key *akey)

View File

@ -18,6 +18,9 @@
#include "widgets/XcaWarning.h"
#warning Drop "widgets dependency"
#include "ui_MainWindow.h"
#include <QThread>
#include <QProgressBar>
#include <ltdl.h>

View File

@ -7,18 +7,16 @@
* and needs to get recompiled every time
*/
#ifndef QMAKE
#include "local.h"
#endif
#ifndef NO_COMMITHASH
#include "commithash.h"
#else
#define COMMITHASH ""
#endif
#define VERSION XCA_VERSION
#ifdef GIT_LOCAL_CHANGES
#define COMMITHASH GIT_COMMIT_REV "+local-changes"
#else
#define COMMITHASH GIT_COMMIT_REV
#endif
const char *version_str(bool html)
{
if (!COMMITHASH[0])

View File

@ -1,8 +1,10 @@
/* Filled in version number from the VERSION file + commit iterator */
#undef XCA_VERSION
#define XCA_VERSION "@PROJECT_VERSION@"
/* usually "xca" */
#undef PACKAGE_TARNAME
#define PACKAGE_TARNAME "@PROJECT_NAME@"
/* usually "X Certificate and Key management" */
#undef PACKAGE_NAME
#define PACKAGE_NAME "@PROJECT_DESCRIPTION@"
#define GIT_COMMIT_REV "@GIT_REV@"
#cmakedefine GIT_LOCAL_CHANGES

View File

@ -1,78 +0,0 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_GNU_MAKE()
#
# DESCRIPTION
#
# This macro searches for a GNU version of make. If a match is found, the
# makefile variable `ifGNUmake' is set to the empty string, otherwise it
# is set to "#". This is useful for including a special features in a
# Makefile, which cannot be handled by other versions of make. The
# variable _cv_gnu_make_command is set to the command to invoke GNU make
# if it exists, the empty string otherwise.
#
# Here is an example of its use:
#
# Makefile.in might contain:
#
# # A failsafe way of putting a dependency rule into a makefile
# $(DEPEND):
# $(CC) -MM $(srcdir)/*.c > $(DEPEND)
#
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
# @ifGNUmake@ include $(DEPEND)
# @ifGNUmake@ endif
#
# Then configure.in would normally contain:
#
# AX_CHECK_GNU_MAKE()
# AC_OUTPUT(Makefile)
#
# Then perhaps to cause gnu make to override any other make, we could do
# something like this (note that GNU make always looks for GNUmakefile
# first):
#
# if ! test x$_cv_gnu_make_command = x ; then
# mv Makefile GNUmakefile
# echo .DEFAULT: > Makefile ;
# echo \ $_cv_gnu_make_command \$@ >> Makefile;
# fi
#
# Then, if any (well almost any) other make is called, and GNU make also
# exists, then the other make wraps the GNU make.
#
# LICENSE
#
# Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
AC_DEFUN([AX_CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
_cv_gnu_make_command='' ;
dnl Search all the common names for GNU make
for a in "$MAKE" make gmake gnumake ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
_cv_gnu_make_command=$a ;
break;
fi
done ;
) ;
dnl If there was a GNU version print its full path, otherwise a Warning
if test "x$_cv_gnu_make_command" != "x" ; then
mak="`which ${_cv_gnu_make_command}`"
AC_MSG_NOTICE([A usable 'make' executable was found in ${mak}])
else
AC_MSG_WARN([No usable 'make' executable found.])
fi
] )

View File

@ -1,47 +0,0 @@
AC_DEFUN([XCA_COMPILE_TEST], [
# Try to compile a little application
#####################################
AC_TRY_RUN([
#include <stdio.h>
#include <string.h>
#include <ltdl.h>
#include <openssl/opensslv.h>
#include <openssl/opensslconf.h>
#include <openssl/crypto.h>
#include <openssl/objects.h>
#include <qglobal.h>
#define C "configure: "
#define WARN C"###################### WARNING ######################\n"
int main(){
char buf[2048] = "";
int r = lt_dlinit();
printf(C"The Versions of the used libraries are:\n"
C"Header:\n"
C"\t%s 0x%lxL\n"
C"\tQT: %s\n"
C"Libraries:\n"
C"\t%s\n"
C"\tQT: %s\n",
OPENSSL_VERSION_TEXT, OPENSSL_VERSION_NUMBER,
QT_VERSION_STR,
SSLeay_version(SSLEAY_VERSION),
qVersion()
);
if (strcmp(QT_VERSION_STR, qVersion()))
strcat(buf, C"The versions of the QT headers and library differ\n");
if (strcmp(OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)))
strcat(buf, C"The versions of the OpenSSL headers and library differ\n");
if (r)
strcat(buf, C"lt_dlinit() returned != 0\n");
#ifdef OPENSSL_NO_EC
strcat(buf, C"This OpenSSL installation has no EC cryptography support\n");
#endif
if (*buf)
printf(WARN "%s" WARN, buf);
return 0;
}
], [ ], [echo "Unable to execute a freshly compiled application, maybe you have to adjust your LD_LIBRARY_PATH or /etc/ld.so.conf"], [echo "Skipping the compile test because of cross-compiling"])
])

View File

@ -9,17 +9,17 @@
<key>NSHighResolutionCapable</key>
<string>True</string>
<key>CFBundleShortVersionString</key>
<string>@XCA_VERSION@</string>
<string>@PROJECT_VERSION@</string>
<key>CFBundleVersion</key>
<string>@XCA_VERSION@</string>
<string>@PROJECT_VERSION@</string>
<key>CFBundleIconFile</key>
<string>xca-icons.icns</string>
<key>CFBundleIdentifier</key>
<string>de.hohnstaedt.xca</string>
<key>CFBundleName</key>
<string>@PACKAGE_TARNAME@</string>
<string>@CMAKE_PROJECT_NAME@</string>
<key>CFBundleDisplayName</key>
<string>@PACKAGE_NAME@</string>
<string>@CMAKE_PROJECT_NAME@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSupportedPlatforms</key>
@ -29,7 +29,7 @@
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>@MACOS_VERSION3@</string>
<string>@CMAKE_OSX_DEPLOYMENT_TARGET@.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<string>no</string>
<key>CFBundleDocumentTypes</key>

View File

@ -1,16 +0,0 @@
ifeq ($(TOPDIR),)
TOPDIR=..
BUILD=..
endif
UI_H = ui_CaProperties.h ui_CertDetail.h ui_CertExtend.h \
ui_CrlDetail.h ui_ExportDialog.h ui_Help.h \
ui_ImportMulti.h ui_KeyDetail.h ui_MainWindow.h ui_NewCrl.h \
ui_NewKey.h ui_NewX509.h ui_Options.h ui_PwDialog.h ui_Revoke.h \
ui_SelectToken.h ui_XcaDialog.h ui_v3ext.h ui_SearchPkcs11.h \
ui_RevocationList.h ui_OidResolver.h ui_OpenDb.h ui_ItemProperties.h
include $(TOPDIR)/Rules.mak
ui all: $(UI_H)

37
widgets/CMakeLists.txt Normal file
View File

@ -0,0 +1,37 @@
include_directories(${Qt5Widgets_INCLUDE_DIRS}
${Qt5Sql_INCLUDE_DIRS}
${Qt5Core_INCLUDE_DIRS}
${Qt5Help_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${LTDL_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}
)
add_library(widgets STATIC
CertDetail.cpp NewCrl.cpp XcaApplication.h
CertDetail.h NewCrl.h XcaDialog.cpp
CertExtend.cpp NewKey.cpp XcaDialog.h
CertExtend.h NewKey.h XcaHeaderView.cpp
CertTreeView.cpp NewX509.cpp XcaHeaderView.h
CertTreeView.h NewX509.h
CrlDetail.cpp NewX509_ext.cpp XcaProxyModel.cpp
CrlDetail.h OidResolver.cpp XcaProxyModel.h
CrlTreeView.cpp OidResolver.h XcaTreeView.cpp
CrlTreeView.h OpenDb.cpp XcaTreeView.h
ExportDialog.cpp OpenDb.h XcaWarning.cpp
ExportDialog.h Options.cpp XcaWarning.h
FocusCombo.h Options.h clicklabel.cpp
Help.cpp PwDialog.cpp clicklabel.h
Help.h PwDialog.h
ImportMulti.cpp ReqTreeView.cpp
ImportMulti.h ReqTreeView.h distname.cpp
ItemCombo.h RevocationList.cpp distname.h
KeyDetail.cpp RevocationList.h hashBox.cpp
KeyDetail.h SearchPkcs11.cpp hashBox.h
KeyTreeView.cpp SearchPkcs11.h kvView.cpp
KeyTreeView.h TempTreeView.cpp kvView.h
MW_help.cpp TempTreeView.h v3ext.cpp
MW_menu.cpp X509SuperTreeView.cpp v3ext.h
MainWindow.cpp X509SuperTreeView.h validity.cpp
MainWindow.h XcaApplication.cpp validity.h
)

View File

@ -9,46 +9,10 @@
#define __EXPORTDIALOG_H
#include "ui_ExportDialog.h"
#include "lib/pki_base.h"
#include "lib/exportType.h"
class QPixmap;
class exportType {
public:
enum etype { Separator, PEM, PEM_chain, PEM_unrevoked, PEM_all,
DER, PKCS7, PKCS7_chain, PKCS7_unrevoked, PKCS7_all,
PKCS12, PKCS12_chain, PEM_cert_key, PEM_cert_pk8,
PEM_key, PEM_private, PEM_private_encrypt, DER_private,
DER_key, PKCS8, PKCS8_encrypt, SSH2_public,
PEM_selected, PKCS7_selected, Index, vcalendar, vcalendar_ca,
PVK_private, PVK_encrypt, SSH2_private, ETYPE_max };
enum etype type;
QString desc;
QString extension;
exportType(enum etype t, QString e, QString d) {
type = t; extension = e; desc = d;
}
exportType() { type = Separator; }
bool isPEM() const {
switch (type) {
case PEM:
case PEM_chain:
case PEM_unrevoked:
case PEM_all:
case PEM_cert_key:
case PEM_cert_pk8:
case PEM_key:
case PEM_private:
case PEM_private_encrypt:
case PEM_selected:
case SSH2_private:
return true;
default:
return false;
}
}
};
Q_DECLARE_METATYPE(exportType);
class pki_base;
class ExportDialog: public QDialog, public Ui::ExportDialog
{

View File

@ -40,6 +40,7 @@
#include "XcaProgressGui.h"
#include "PwDialog.h"
#include "OpenDb.h"
#include "Help.h"
#include "OidResolver.h"
OidResolver *MainWindow::resolver = NULL;

View File

@ -1,18 +0,0 @@
ifeq ($(TOPDIR),)
TOPDIR=..
BUILD=..
endif
MOC_NAMES=MainWindow KeyDetail clicklabel XcaTreeView NewX509 \
validity v3ext distname CertDetail CertExtend PwDialog \
ImportMulti CrlDetail ExportDialog hashBox Options NewKey kvView \
NewCrl SearchPkcs11 RevocationList XcaProxyModel XcaHeaderView \
KeyTreeView TempTreeView ReqTreeView X509SuperTreeView CertTreeView \
OidResolver OpenDb XcaWarning CrlTreeView XcaApplication Help
NAMES=$(MOC_NAMES) NewX509_ext MW_menu MW_help
OBJS=$(patsubst %,moc_%.o,$(MOC_NAMES)) $(patsubst %,%.o,$(NAMES))
include $(TOPDIR)/Rules.mak
sinclude .depend

57
widgets/XcaDialog.cpp Normal file
View File

@ -0,0 +1,57 @@
/* vi: set sw=4 ts=4:
*
* Copyright (C) 2015 Christian Hohnstaedt.
*
* All rights reserved.
*/
#include <QPixmap>
#include "XcaDialog.h"
#include "MainWindow.h"
#include "Help.h"
// index = enum pki_type
static const char * const PixmapMap[] = {
"" ":keyImg", ":csrImg", ":certImg", ":revImg", ":tempImg", "", ":scardImg",
};
XcaDialog::XcaDialog(QWidget *parent, enum pki_type type, QWidget *w,
const QString &t, const QString &desc,
const QString &help_ctx)
: QDialog(parent ?: mainwin)
{
setupUi(this);
setWindowTitle(XCA_TITLE);
image->setPixmap(QPixmap(PixmapMap[type]));
content->addWidget(w);
mainwin->helpdlg->register_ctxhelp_button(this, help_ctx);
widg = w;
title->setText(t);
if (desc.isEmpty()) {
verticalLayout->removeWidget(description);
delete description;
} else {
description->setText(desc);
}
}
void XcaDialog::noSpacer()
{
verticalLayout->removeItem(topSpacer);
verticalLayout->removeItem(bottomSpacer);
delete topSpacer;
delete bottomSpacer;
if (widg)
widg->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
}
void XcaDialog::aboutDialog(const QPixmap &left)
{
title->setPixmap(left.scaledToHeight(title->height()));
noSpacer();
resize(560, 400);
buttonBox->setStandardButtons(QDialogButtonBox::Ok);
buttonBox->centerButtons();
}

View File

@ -8,58 +8,19 @@
#ifndef __XCADIALOG_H
#define __XCADIALOG_H
#include <QList>
#include <QDialog>
#include "ui_XcaDialog.h"
#include "MainWindow.h"
#include "Help.h"
// index = enum pki_type
static const char * const PixmapMap[] = {
"" ":keyImg", ":csrImg", ":certImg", ":revImg", ":tempImg", "", ":scardImg",
};
#include "lib/pki_base.h"
class XcaDialog : public QDialog, public Ui::XcaDialog
{
QWidget *widg;
public:
XcaDialog(QWidget *parent, enum pki_type type, QWidget *w, QString t,
QString desc, QString help_ctx = QString())
: QDialog(parent ?: mainwin)
{
setupUi(this);
setWindowTitle(XCA_TITLE);
image->setPixmap(QPixmap(PixmapMap[type]));
content->addWidget(w);
mainwin->helpdlg->register_ctxhelp_button(this, help_ctx);
widg = w;
title->setText(t);
if (desc.isEmpty()) {
verticalLayout->removeWidget(description);
delete description;
} else {
description->setText(desc);
}
}
void noSpacer()
{
verticalLayout->removeItem(topSpacer);
verticalLayout->removeItem(bottomSpacer);
delete topSpacer;
delete bottomSpacer;
if (widg)
widg->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
}
void aboutDialog(const QPixmap &left)
{
title->setPixmap(left.scaledToHeight(title->height()));
noSpacer();
resize(560, 400);
buttonBox->setStandardButtons(QDialogButtonBox::Ok);
buttonBox->centerButtons();
}
XcaDialog(QWidget *parent, enum pki_type type, QWidget *w,
const QString &t, const QString &desc,
const QString &help_ctx = QString());
void noSpacer();
void aboutDialog(const QPixmap &left);
};
#endif

241
xca.pro
View File

@ -1,241 +0,0 @@
TEMPLATE = app
TARGET = xca
DEPENDPATH += . lang lib ui widgets
INCLUDEPATH += . lib widgets
QMAKE_MAKEFILE = makefile
QT = gui core sql widgets
QT += help
RESOURCES = img/imgres.rcc
RC_FILE = img/w32res.rc
macx {
ICON = img/xca-mac-icon.icns
CONFIG += release_and_debug
XCA_RESOURCES.files = misc/oids.txt misc/dn.txt misc/eku.txt
XCA_RESOURCES.files += misc/CA.xca misc/TLS_client.xca misc/TLS_server.xca
XCA_RESOURCES.files += lang/xca_de.qm lang/xca_es.qm lang/xca_ru.qm lang/xca_fr.qm
XCA_RESOURCES.files += lang/xca_hr.qm lang/xca_it.ts lang/xca_ja.ts lang/xca_nl.ts
XCA_RESOURCES.files += lang/xca_pl.ts lang/xca_sk.ts lang/xca_tr.ts
XCA_RESOURCES.files += lang/xca_zh_CN.ts lang/xca_pt_BR.ts
XCA_RESOURCES.path = Contents/Resources
QMAKE_BUNDLE_DATA += XCA_RESOURCES
}
LIBS += -lcrypto -lltdl
QMAKE_CXXFLAGS = -Werror -DQMAKE
DEFINES += XCA_VERSION=\\\"'$$system(cat VERSION)'\\\"
!win32 {
commithash.h.commands = ./gen_commithash.h.sh \$@
commithash.h.depends = FORCE
QMAKE_EXTRA_TARGETS += commithash.h
}
win32 {
DEFINES += NO_COMMITHASH
}
# Input
HEADERS += lib/asn1int.h \
lib/asn1time.h \
lib/base.h \
lib/db_base.h \
lib/db_crl.h \
lib/db_key.h \
lib/db_temp.h \
lib/db_token.h \
lib/db_x509.h \
lib/db_x509req.h \
lib/db_x509super.h \
lib/exception.h \
lib/func.h \
lib/headerlist.h \
lib/load_obj.h \
lib/main.h \
lib/oid.h \
lib/opensc-pkcs11.h \
lib/pass_info.h \
lib/Passwd.h \
lib/pk11_attribute.h \
lib/pkcs11.h \
lib/pkcs11_lib.h \
lib/pki_base.h \
lib/pki_crl.h \
lib/pki_evp.h \
lib/pki_key.h \
lib/pki_multi.h \
lib/pki_pkcs12.h \
lib/pki_pkcs7.h \
lib/pki_scard.h \
lib/pki_temp.h \
lib/pki_x509.h \
lib/pki_x509req.h \
lib/pki_x509super.h \
lib/x509name.h \
lib/x509rev.h \
lib/x509v3ext.h \
lib/builtin_curves.h \
lib/entropy.h \
lib/settings.h \
lib/sql.h \
lib/database_model.h \
lib/arguments.h \
lib/BioByteArray.h \
lib/dbhistory.h \
widgets/CertDetail.h \
widgets/CertExtend.h \
widgets/clicklabel.h \
widgets/CrlDetail.h \
widgets/distname.h \
widgets/ExportDialog.h \
widgets/hashBox.h \
widgets/ImportMulti.h \
widgets/KeyDetail.h \
widgets/kvView.h \
widgets/MainWindow.h \
widgets/NewCrl.h \
widgets/NewKey.h \
widgets/NewX509.h \
widgets/Options.h \
widgets/PwDialog.h \
widgets/v3ext.h \
widgets/validity.h \
widgets/SearchPkcs11.h \
widgets/RevocationList.h \
widgets/XcaTreeView.h \
widgets/CertTreeView.h \
widgets/KeyTreeView.h \
widgets/ReqTreeView.h \
widgets/TempTreeView.h \
widgets/CrlTreeView.h \
widgets/X509SuperTreeView.h \
widgets/XcaHeaderView.h \
widgets/OidResolver.h \
widgets/ItemCombo.h \
widgets/XcaDialog.h \
widgets/XcaProxyModel.h \
widgets/XcaApplication.h \
widgets/XcaWarning.h \
widgets/Help.h \
widgets/OpenDb.h
FORMS += ui/CaProperties.ui \
ui/CertDetail.ui \
ui/CertExtend.ui \
ui/CrlDetail.ui \
ui/ExportDialog.ui \
ui/Help.ui \
ui/ImportMulti.ui \
ui/KeyDetail.ui \
ui/MainWindow.ui \
ui/NewCrl.ui \
ui/NewKey.ui \
ui/NewX509.ui \
ui/Options.ui \
ui/PwDialog.ui \
ui/Revoke.ui \
ui/SelectToken.ui \
ui/SearchPkcs11.ui \
ui/v3ext.ui \
ui/OidResolver.ui \
ui/XcaDialog.ui \
ui/RevocationList.ui \
ui/OpenDb.ui \
ui/ItemProperties.ui
SOURCES += lib/asn1int.cpp \
lib/asn1time.cpp \
lib/db_base.cpp \
lib/db_crl.cpp \
lib/db_key.cpp \
lib/db_temp.cpp \
lib/db_token.cpp \
lib/db_x509.cpp \
lib/db_x509req.cpp \
lib/db_x509super.cpp \
lib/func.cpp \
lib/load_obj.cpp \
lib/main.cpp \
lib/oid.cpp \
lib/pass_info.cpp \
lib/Passwd.cpp \
lib/pk11_attribute.cpp \
lib/pkcs11.cpp \
lib/pkcs11_lib.cpp \
lib/pki_base.cpp \
lib/pki_crl.cpp \
lib/pki_evp.cpp \
lib/pki_key.cpp \
lib/pki_multi.cpp \
lib/pki_pkcs12.cpp \
lib/pki_pkcs7.cpp \
lib/pki_scard.cpp \
lib/pki_temp.cpp \
lib/pki_x509.cpp \
lib/pki_x509req.cpp \
lib/pki_x509super.cpp \
lib/x509name.cpp \
lib/x509rev.cpp \
lib/x509v3ext.cpp \
lib/builtin_curves.cpp \
lib/entropy.cpp \
lib/settings.cpp \
lib/version.cpp \
lib/sql.cpp \
lib/database_model.cpp \
lib/arguments.cpp \
lib/BioByteArray.cpp \
lib/dbhistory.cpp \
widgets/CertDetail.cpp \
widgets/CertExtend.cpp \
widgets/clicklabel.cpp \
widgets/CrlDetail.cpp \
widgets/distname.cpp \
widgets/ExportDialog.cpp \
widgets/hashBox.cpp \
widgets/ImportMulti.cpp \
widgets/KeyDetail.cpp \
widgets/kvView.cpp \
widgets/MainWindow.cpp \
widgets/MW_help.cpp \
widgets/MW_menu.cpp \
widgets/NewCrl.cpp \
widgets/NewKey.cpp \
widgets/NewX509.cpp \
widgets/NewX509_ext.cpp \
widgets/Options.cpp \
widgets/PwDialog.cpp \
widgets/v3ext.cpp \
widgets/validity.cpp \
widgets/SearchPkcs11.cpp \
widgets/RevocationList.cpp \
widgets/XcaTreeView.cpp \
widgets/CertTreeView.cpp \
widgets/KeyTreeView.cpp \
widgets/ReqTreeView.cpp \
widgets/TempTreeView.cpp \
widgets/CrlTreeView.cpp \
widgets/X509SuperTreeView.cpp \
widgets/XcaHeaderView.cpp \
widgets/OidResolver.cpp \
widgets/XcaProxyModel.cpp \
widgets/XcaApplication.cpp \
widgets/XcaWarning.cpp \
widgets/Help.cpp \
widgets/OpenDb.cpp
TRANSLATIONS += lang/xca.ts \
lang/xca_de.ts \
lang/xca_es.ts \
lang/xca_fr.ts \
lang/xca_hr.ts \
lang/xca_it.ts \
lang/xca_ja.ts \
lang/xca_nl.ts \
lang/xca_pl.ts \
lang/xca_pt_BR.ts \
lang/xca_ru.ts \
lang/xca_sk.ts \
lang/xca_tr.ts \
lang/xca_zh_CN.ts \

30
xcadoc.cpp Normal file
View File

@ -0,0 +1,30 @@
#include <iostream>
#include <QString>
#include <QFile>
#include "arguments.h"
using namespace std;
int main(int argc, char *argv[])
{
if (argc < 2) {
cerr << "Need type argument: <man|rst|completion>" << endl;
return EXIT_FAILURE;
}
QString doc = arguments::doc(argv[1]);
if (doc.isEmpty()) {
cerr << "Doc was empty: " << argv[1] << endl;
return EXIT_FAILURE;
}
if (argc == 2) {
cout << doc.toUtf8().constData() << endl;
return EXIT_SUCCESS;
}
QFile f(argv[2]);
f.open(QIODevice::WriteOnly);
f.write(doc.toUtf8());
f.close();
return EXIT_SUCCESS;
}