Skip to content

Commit 7e7709f

Browse files
committed
chore: remove binary signing feature
- remove GPGFRONTEND_SIGN_BUILT_BINARY option from cmake - remove signing logic from build workflows - remove key generation and signing code - remove related resource file generation
1 parent 10871f3 commit 7e7709f

7 files changed

Lines changed: 0 additions & 96 deletions

File tree

.github/workflows/release-qt5.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ jobs:
157157
mkdir build && cd build
158158
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
159159
-DGPGFRONTEND_QT5_BUILD=ON \
160-
-DGPGFRONTEND_SIGN_BUILT_BINARY=ON \
161160
-DGPGFRONTEND_LINK_GPGME_INTO_CORE=ON \
162161
..
163162
cmake --build . --config ${{env.BUILD_TYPE}} -- -j 4

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ jobs:
304304
cd $(cygpath -u "${{github.workspace}}")
305305
mkdir build && cd build
306306
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
307-
-DGPGFRONTEND_SIGN_BUILT_BINARY=ON \
308307
-DGPGFRONTEND_LINK_GPGME_INTO_CORE=ON \
309308
..
310309
cmake --build . --config ${{env.BUILD_TYPE}} -- -j 4

.github/workflows/testing-nightly.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ jobs:
298298
cd $(cygpath -u "${{github.workspace}}")
299299
mkdir build && cd build
300300
cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
301-
-DGPGFRONTEND_SIGN_BUILT_BINARY=ON \
302301
-DGPGFRONTEND_LINK_GPGME_INTO_CORE=ON \
303302
..
304303
cmake --build . --config ${{env.BUILD_TYPE}} -- -j 4

CMakeLists.txt

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ option(GPGFRONTEND_XCODE_ENABLE_SANDBOX "Enable SandBox For Xcode Build" OFF)
7070

7171
# check options
7272
option(GPGFRONTEND_CHECK_RELEASE_COMMIT_HASH "Enable checking on commit hash from the GitHub release" OFF)
73-
option(GPGFRONTEND_SIGN_BUILT_BINARY "Use OpenSSL to sign shared libraries and executables" OFF)
7473
option(GPGFRONTEND_LINK_GPGME_INTO_CORE "Statically link GpgME into the core library" OFF)
7574
option(GPGFRONTEND_LINK_OPENSSL_INTO_EXEC "Statically link OpenSSL into the executable" OFF)
7675

@@ -109,12 +108,6 @@ else()
109108
set(BUILD_STRIP_RPATH 0)
110109
endif()
111110

112-
if(GPGFRONTEND_SIGN_BUILT_BINARY)
113-
set(SIGN_BUILT_BINARY 1)
114-
else()
115-
set(SIGN_BUILT_BINARY 0)
116-
endif()
117-
118111
if(GPGFRONTEND_LINK_GPGME_INTO_CORE)
119112
set(BUILD_AND_STATIC_LINK_GPGME 1)
120113
else()
@@ -435,41 +428,6 @@ else()
435428
endif()
436429
endif()
437430

438-
if(SIGN_BUILT_BINARY)
439-
set(SIGN_KEYS_DIR "${CMAKE_BINARY_DIR}/keys")
440-
file(MAKE_DIRECTORY "${SIGN_KEYS_DIR}")
441-
442-
set(SIGN_PRIVATE_KEY "${SIGN_KEYS_DIR}/private.pem")
443-
set(SIGN_PUBLIC_KEY "${SIGN_KEYS_DIR}/public.pem")
444-
445-
find_program(OPENSSL_EXECUTABLE NAMES openssl)
446-
447-
if(NOT OPENSSL_EXECUTABLE)
448-
message(FATAL_ERROR "Signing is enabled (SIGN_BUILT_BINARY=ON), but openssl executable not found, please install OpenSSL.")
449-
endif()
450-
451-
execute_process(
452-
COMMAND ${OPENSSL_EXECUTABLE} genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out "${SIGN_PRIVATE_KEY}"
453-
RESULT_VARIABLE result_priv
454-
)
455-
456-
if(NOT result_priv EQUAL 0)
457-
message(FATAL_ERROR "Failed to generate private key for binary signing.")
458-
endif()
459-
460-
execute_process(
461-
COMMAND ${OPENSSL_EXECUTABLE} pkey -in "${SIGN_PRIVATE_KEY}" -pubout -out "${SIGN_PUBLIC_KEY}"
462-
RESULT_VARIABLE result_pub
463-
)
464-
465-
if(NOT result_pub EQUAL 0)
466-
message(FATAL_ERROR "Failed to generate public key for binary signing.")
467-
endif()
468-
469-
message(STATUS "Binary Signing Private Key: ${SIGN_PRIVATE_KEY}")
470-
message(STATUS "Binary Signing Public Key: ${SIGN_PUBLIC_KEY}")
471-
endif()
472-
473431
if(BUILD_AND_STATIC_LINK_GPGME)
474432
add_subdirectory(third_party)
475433
endif()

cmake/LibraryRegistry.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ function(register_library name out_var)
3535
set_target_properties(${target_name} PROPERTIES
3636
VERSION ${PROJECT_VERSION})
3737

38-
if(SIGN_BUILT_BINARY)
39-
add_custom_command(TARGET ${target_name} POST_BUILD
40-
COMMAND ${OPENSSL_EXECUTABLE} dgst -sha256 -sign "${SIGN_PRIVATE_KEY}"
41-
-out "$<TARGET_FILE:${target_name}>.sig" "$<TARGET_FILE:${target_name}>"
42-
VERBATIM
43-
)
44-
endif()
45-
4638
set_target_properties(${target_name} PROPERTIES
4739
POSITION_INDEPENDENT_CODE ON
4840
CXX_VISIBILITY_PRESET hidden

cmake/ModuleRegistry.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ function(register_module name out_var)
3434

3535
set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE ON)
3636

37-
if(SIGN_BUILT_BINARY)
38-
add_custom_command(TARGET ${target_name} POST_BUILD
39-
COMMAND ${OPENSSL_EXECUTABLE} dgst -sha256 -sign "${SIGN_PRIVATE_KEY}"
40-
-out "$<TARGET_FILE:${target_name}>.sig" "$<TARGET_FILE:${target_name}>"
41-
VERBATIM
42-
)
43-
endif()
44-
4537
target_compile_features(${target_name} PRIVATE cxx_std_17)
4638

4739
target_link_libraries(${target_name} PRIVATE gf_sdk)

src/CMakeLists.txt

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -321,41 +321,6 @@ if(MINGW)
321321
endforeach()
322322
endif()
323323

324-
if(SIGN_BUILT_BINARY)
325-
if(GPGFRONTEND_QT5_BUILD)
326-
set(KEYS_QRC_FILE "${CMAKE_CURRENT_BINARY_DIR}/keys_resources.qrc")
327-
328-
file(WRITE ${KEYS_QRC_FILE}
329-
"<!DOCTYPE RCC>\n"
330-
"<RCC version=\"1.0\">\n"
331-
" <qresource prefix=\"/keys\">\n"
332-
)
333-
334-
foreach(PUBKEY_FILE ${SIGN_PUBLIC_KEY})
335-
get_filename_component(PUBKEY_FILENAME ${PUBKEY_FILE} NAME)
336-
file(APPEND ${KEYS_QRC_FILE}
337-
" <file alias=\"${PUBKEY_FILENAME}\">${PUBKEY_FILE}</file>\n"
338-
)
339-
endforeach()
340-
341-
file(APPEND ${KEYS_QRC_FILE}
342-
" </qresource>\n"
343-
"</RCC>\n"
344-
)
345-
346-
qt5_add_resources(KEYS_RESOURCES ${KEYS_QRC_FILE})
347-
348-
target_sources(${APP_NAME} PRIVATE ${KEYS_RESOURCES})
349-
350-
else()
351-
qt_add_resources(${APP_NAME} "binaryvalidation"
352-
PREFIX "/keys"
353-
BASE "${CMAKE_BINARY_DIR}/keys"
354-
FILES ${SIGN_PUBLIC_KEY}
355-
)
356-
endif()
357-
endif()
358-
359324
# link options for GpgFrontend
360325
target_link_libraries(${APP_NAME} gf_core gf_ui gf_test)
361326

0 commit comments

Comments
 (0)