Skip to content

Commit

Permalink
[qca] added PS script to extract local certs from store
Browse files Browse the repository at this point in the history
  • Loading branch information
gnome71 committed Nov 30, 2016
1 parent 069fb0f commit 5a04753
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 8 deletions.
23 changes: 16 additions & 7 deletions ports/qca/0001-fix-path-for-vcpkg.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From bab44a6614d4a540af56860432bcc0d6bdf420c9 Mon Sep 17 00:00:00 2001
From: devel <alexander.kaspar@gmail.com>
Date: Wed, 23 Nov 2016 16:54:44 +0100
From a3a8d50f3bdcb4df630f7126718c21f23efd7832 Mon Sep 17 00:00:00 2001
From: Alexander Kaspar <alexander.kaspar@gmail.com>
Date: Wed, 30 Nov 2016 15:45:12 +0100
Subject: [PATCH] fix path for vcpkg

---
CMakeLists.txt | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
CMakeLists.txt | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 605621b..a8c3774 100644
index 605621b..3b5a9be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -277,7 +277,7 @@ if(DEVELOPER_MODE)
Expand All @@ -20,6 +20,15 @@ index 605621b..a8c3774 100644
")
endif()

@@ -320,7 +320,7 @@ else (qca_CERTSTORE)
set( qca_CERTSTORE "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem")
# note that INSTALL_FILES targets are relative to the current installation prefix...
if(NOT DEVELOPER_MODE)
- install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/certs")
+ install(FILES "${qca_CERTSTORE}" DESTINATION "${QCA_PREFIX_INSTALL_DIR}/share/qca/certs")
endif()
endif (qca_CERTSTORE)
message(STATUS "certstore path: " ${qca_CERTSTORE})
@@ -401,10 +401,10 @@ endif(DOXYGEN_FOUND)
include(CMakePackageConfigHelpers)
configure_package_config_file(
Expand Down Expand Up @@ -50,5 +59,5 @@ index 605621b..a8c3774 100644
)
endif()
--
2.9.2.windows.1
2.8.1.windows.1

35 changes: 35 additions & 0 deletions ports/qca/import-local-certificates.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# According to:
# https://www.openssl.org/docs/faq.html#USER16
# it is up to developers or admins to maintain CAs.
#
# This script imports LocalMachine certificates into rootcerts.pem
# needed by qca.
#
# PS> .\import-local-certificates.ps1 -certstore Root -outpath C:\src\git\vcpkg\ports\qca
#

param (
# one of Root, My, CA, ...
[string]$certstore = "Root",
# the path where it should be in qca buildtree (without trailing '\')
[Parameter(Mandatory=$true)][string]$outpath
)

$certs = (Get-ChildItem -Path 'Cert:\LocalMachine\Root')
$outfile = $outpath + "\rootcerts.pem"

Write-Host "Importing: " $certs.Count " certificates ..."

foreach ($cert in $certs)
{
$certs.GetIssuerName()
$out = New-Object String[] -ArgumentList 3
$out[0] = "-----BEGIN CERTIFICATE-----"
$out[1] = [System.Convert]::ToBase64String($cert.PublicKey.EncodedKeyValue.RawData, "InsertLineBreaks")
$out[2] = "-----END CERTIFICATE-----"

[System.IO.File]::AppendAllLines($outfile, $out)
}

Write-Host "Written to: " $outfile
Write-Host "Importing certificates done."
17 changes: 16 additions & 1 deletion ports/qca/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ vcpkg_configure_cmake(
-DUSE_RELATIVE_PATHS=ON
-DQT4_BUILD=OFF
-DBUILD_TESTS=OFF
-DBUILD_TOOLS=OFF
-DBUILD_TOOLS=ON
-DQCA_SUFFIX=OFF
-DQCA_FEATURE_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/share/qca/mkspecs/features
OPTIONS_DEBUG
-DQCA_PLUGINS_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/bin/Qca
OPTIONS_RELEASE
Expand Down Expand Up @@ -84,6 +85,20 @@ file(WRITE ${CURRENT_PACKAGES_DIR}/share/qca/cmake/QcaTargets.cmake
"${QCA_TARGET_CONFIG}"
)

# Move tools
file(COPY ${CURRENT_PACKAGES_DIR}/bin/mozcerts.exe
DESTINATION ${CURRENT_PACKAGES_DIR}/share/qca/tools
)
file(COPY ${CURRENT_PACKAGES_DIR}/bin/qcatool.exe
DESTINATION ${CURRENT_PACKAGES_DIR}/share/qca/tools
)
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/mozcerts.exe
${CURRENT_PACKAGES_DIR}/bin/qcatool.exe
${CURRENT_PACKAGES_DIR}/debug/bin/mozcerts.exe
${CURRENT_PACKAGES_DIR}/debug/bin/mozcerts.pdb
${CURRENT_PACKAGES_DIR}/debug/bin/qcatool.exe
)

# Remove unneeded dirs
file(REMOVE_RECURSE
${CURRENT_BUILDTREES_DIR}/share/man
Expand Down

0 comments on commit 5a04753

Please sign in to comment.