diff --git a/JenkinsfileMacOS b/JenkinsfileMacOS index a36918b..6c72742 100644 --- a/JenkinsfileMacOS +++ b/JenkinsfileMacOS @@ -49,23 +49,23 @@ pipeline { sh 'npm -version' sh 'cat ~/.npmrc || true' - // Actual CI Build, Tests, Demo App + // Actual CI Build, Tests, Demo App sh label: 'starting ios test run', script: '''#!/bin/bash -l set -ev ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=$https_proxy npm ci ''' - } + + // copy LICENSE.txt into ./src/assets/license_de.txt to add it to the DMG file + sh 'iconv -f windows-1250 -t utf-8 LICENSE.txt > ./src/assets/license_de.txt' + } } - stage ('Set BUILD_VERSION') { + stage('Set BUILD_VERSION') { steps { script { def packageJson = readFile(file: 'package.json') - def parsedJson = new groovy.json.JsonSlurper().parseText(packageJson) - env.BUILD_VERSION = parsedJson.version - echo "Build version: ${env.BUILD_VERSION}" } } @@ -85,13 +85,10 @@ pipeline { sh "echo LOCAL_KT='kon23/cats' >> .env" sh "echo REMOTE_KT='kon23/cats2' >> .env" sh "echo CONNECTOR_PATH='/kon23' >> .env" - try { + lock(resource: 'authenticator-k23') { sh 'npm run test -- --silent' - } catch (Exception e) { - echo 'Running additional tests for failures...' - sh 'npm run test:fail -- --silent' - } finally { junit checksName: 'Jest Tests', testResults: 'jenkins-jest-test-report.xml' + stash name: 'test-reports', includes: '*.xml,coverage/lcov.info' } } } @@ -182,7 +179,7 @@ pipeline { sh 'cp sha256Hash.txt releaseCI/' - if ( params.MOCK_BUILD == true ) { + if (params.MOCK_BUILD == true) { def filePathMock = "releaseCI/gematik-Authenticator-Mock-Version-${env.BUILD_VERSION}.dmg" def sha256HashMock = sha256 file: filePathMock @@ -202,7 +199,6 @@ pipeline { expression { params.ARCHIVE_ARTIFACTS == true } buildingTag() } - } steps { script { @@ -212,7 +208,7 @@ pipeline { nexusFileUpload("./releaseCI/latest-mac.yml", "de/gematik/authenticator/snapshot/macOS/latest-mac.yml", "gematik_snapshots_raw") nexusFileUpload("releaseCI/sha256Hash.txt", "de/gematik/authenticator/${BUILD_VERSION}/windows/sha256Hash.txt", "gematik_releases_raw") - if ( params.MOCK_BUILD == true ) { + if (params.MOCK_BUILD == true) { nexusFileUpload("./releaseCI/gematik-Authenticator-Mock-Version-${env.BUILD_VERSION}.dmg", "de/gematik/authenticator/snapshot/macOS/gematik-Authenticator-Mock-Version-${env.BUILD_VERSION}.dmg", "gematik_snapshots_raw") nexusFileUpload("releaseCI/sha256HashMock.txt", "de/gematik/authenticator/${BUILD_VERSION}/windows/sha256HashMock.txt", "gematik_releases_raw") } @@ -221,10 +217,10 @@ pipeline { } stage('Nexus Upload: Releases') { when { - allOf { - expression { params.SIGN_ARTIFACTS } - branch 'release' - } + allOf { + expression { params.SIGN_ARTIFACTS } + branch 'release' + } } steps { script { @@ -235,7 +231,7 @@ pipeline { nexusFileUpload("./releaseCI/latest-mac.yml", "de/gematik/authenticator/snapshot/macOS/latest-mac.yml", "gematik_releases_raw") nexusFileUpload("releaseCI/sha256Hash.txt", "de/gematik/authenticator/${BUILD_VERSION}/windows/sha256Hash.txt", "gematik_releases_raw") - if ( params.MOCK_BUILD == true ) { + if (params.MOCK_BUILD == true) { nexusFileUpload("./releaseCI/gematik-Authenticator-Mock-Version-${env.BUILD_VERSION}.dmg", "de/gematik/authenticator/snapshot/macOS/gematik-Authenticator-Mock-Version-${env.BUILD_VERSION}.dmg", "gematik_releases_raw") nexusFileUpload("releaseCI/sha256HashMock.txt", "de/gematik/authenticator/${BUILD_VERSION}/windows/sha256HashMock.txt", "gematik_releases_raw") } @@ -259,16 +255,16 @@ pipeline { stage('Archive Build Log') { when { allOf { - branch 'release' - expression { params.SIGN_ARTIFACTS } + branch 'release' + expression { params.SIGN_ARTIFACTS } } } steps { - build job: 'Authenticator-Authenticator_Archive_Buildlog-Release', - parameters: [ - string(name: 'BUILDNUMBER', value: "${BUILD_NUMBER}"), - string(name: 'COMMIT_MESSAGE', value: "Save Log for Build ${BUILD_NUMBER}") - ] + build job: 'Authenticator-Authenticator_Archive_Buildlog-Release', + parameters: [ + string(name: 'BUILDNUMBER', value: "${BUILD_NUMBER}"), + string(name: 'COMMIT_MESSAGE', value: "Save Log for Build ${BUILD_NUMBER}") + ] } } } diff --git a/ReleaseNotes.md b/ReleaseNotes.md index d645802..1de4fbe 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -2,6 +2,13 @@ # Release Authenticator +## Version 4.13.2 + +### Fixed + +- Certificate repair functionality +- Using own trust store + ## Version 4.13.1 ### Fixed diff --git a/builder.config.js b/builder.config.js index 15bf542..d74a2d7 100644 --- a/builder.config.js +++ b/builder.config.js @@ -45,12 +45,12 @@ module.exports = { win: { target: ['nsis'], publisherName: PUBLISHER_NAME, - extraResources: [ - { - from: 'dist_electron/WinCertStoreLib.dll', - to: 'WinCertStoreLib.dll', - }, - ], + // extraResources: [ + // { + // from: 'dist_electron/WinCertStoreLib.dll', + // to: 'WinCertStoreLib.dll', + // }, + // ], }, files: ['!*', 'dist_electron/*'], forceCodeSigning: FORCE_SIGNING, diff --git a/package-lock.json b/package-lock.json index 0c8a094..79402fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "authenticator", - "version": "4.13.1", + "version": "4.13.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "authenticator", - "version": "4.13.1", + "version": "4.13.2", "hasInstallScript": true, "license": "European Union Public License 1.2", "dependencies": { @@ -39,7 +39,7 @@ "winston": "^3.14.2", "winston-daily-rotate-file": "^5.0.0", "xml2js": "^0.6.2", - "zip-a-folder": "^3.1.7" + "zip-a-folder": "^3.1.8" }, "devDependencies": { "@babel/core": "^7.25.2", @@ -10900,10 +10900,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "license": "MIT", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -13535,79 +13534,6 @@ "node": ">=6" } }, - "node_modules/execa/node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/execa/node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/execa/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/execa/node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/execa/node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/execa/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -19497,13 +19423,6 @@ "dev": true, "license": "MIT" }, - "node_modules/nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true, - "license": "MIT" - }, "node_modules/no-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", @@ -27213,13 +27132,12 @@ } }, "node_modules/zip-a-folder": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/zip-a-folder/-/zip-a-folder-3.1.7.tgz", - "integrity": "sha512-pnY1fwTBYiwqXexCYCK8D/asfBhJ9BnnBlt6Qjx53cjBq+9JO+hhOZSt/1N05d3xf/21DhWySSugelyj6dLrYA==", - "license": "MIT", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/zip-a-folder/-/zip-a-folder-3.1.8.tgz", + "integrity": "sha512-P8PrFMSWe+U9roaZ3MNc/cYWc3JejfJVWz0u7nGbp60C2ZtdswJVtyHjAL60V9314KI0uQN8RasgrV3yr324Hg==", "dependencies": { "archiver": "^7.0.1", - "glob": "^10.4.1", + "glob": "^11.0.0", "is-glob": "^4.0.3" } }, @@ -27259,6 +27177,39 @@ "node": ">= 14" } }, + "node_modules/zip-a-folder/node_modules/archiver-utils/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/zip-a-folder/node_modules/archiver-utils/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/zip-a-folder/node_modules/buffer-crc32": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", @@ -27298,21 +27249,52 @@ } }, "node_modules/zip-a-folder/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "license": "ISC", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", + "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" + "path-scurry": "^2.0.0" }, "bin": { "glob": "dist/esm/bin.mjs" }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/zip-a-folder/node_modules/glob/node_modules/jackspeak": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", + "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/zip-a-folder/node_modules/glob/node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, "funding": { "url": "https://github.com/sponsors/isaacs" } @@ -27329,19 +27311,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/zip-a-folder/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, + "node_modules/zip-a-folder/node_modules/lru-cache": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz", + "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==", "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": "20 || >=22" } }, "node_modules/zip-a-folder/node_modules/minipass": { diff --git a/package.json b/package.json index 7fec99c..fb2df45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "authenticator", - "version": "4.13.1", + "version": "4.13.2", "private": true, "author": "Gematik GmbH", "description": "Authenticator Desktop Client", @@ -54,7 +54,7 @@ "winston": "^3.14.2", "winston-daily-rotate-file": "^5.0.0", "xml2js": "^0.6.2", - "zip-a-folder": "^3.1.7" + "zip-a-folder": "^3.1.8" }, "devDependencies": { "@babel/core": "^7.25.2", @@ -131,6 +131,7 @@ "overrides": { "undici": "6.19.7", "autoprefixer": "^10.4.20", - "postcss": "^8.4.47" + "postcss": "^8.4.47", + "cross-spawn": "7.0.6" } } diff --git a/src/assets/certs-idp/RCA2_KOMPCA24.pem b/src/assets/certs-idp/RCA2_KOMPCA24.pem deleted file mode 100644 index 2f7d23d..0000000 --- a/src/assets/certs-idp/RCA2_KOMPCA24.pem +++ /dev/null @@ -1,53 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIErDCCA5SgAwIBAgIBCTANBgkqhkiG9w0BAQsFADCBgTELMAkGA1UEBhMCREUx -HzAdBgNVBAoMFmdlbWF0aWsgR21iSCBOT1QtVkFMSUQxNDAyBgNVBAsMK1plbnRy -YWxlIFJvb3QtQ0EgZGVyIFRlbGVtYXRpa2luZnJhc3RydWt0dXIxGzAZBgNVBAMM -EkdFTS5SQ0EyIFRFU1QtT05MWTAeFw0xNjEyMTQxMDE3NTJaFw0yNDEyMTIxMDE3 -NTFaMIGEMQswCQYDVQQGEwJERTEfMB0GA1UECgwWZ2VtYXRpayBHbWJIIE5PVC1W -QUxJRDEyMDAGA1UECwwpS29tcG9uZW50ZW4tQ0EgZGVyIFRlbGVtYXRpa2luZnJh -c3RydWt0dXIxIDAeBgNVBAMMF0dFTS5LT01QLUNBMjQgVEVTVC1PTkxZMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7nGt2dCCcFbdhSr6m2oQw+VbbHNg -Ng6XSivv2xb4gJ658Nua7fJkNp1G9YpvK5l1dUxJPlXBAclgBpvq+dFv9eX4C0Lh -eThmL8HdGnpa7zMO4gXp8GLEHBR5l01GtYYIEeOlb1QH5V/ufQYam7nS54OShoDQ -yQDx6JQoL0Z0oS2VNPeV5HPQDN7gOfOkEWE8VS70W1cESf4xSVjgsPZvxpsE3O0A -5MsyYFyA0nwBY+e7T/KxUhR74B9HQGa7FX7k+pwQjdCgC+qMnTMbQL9bxVnUShzh -I+YETS66DTrJKOP8Ew6eXdepjCuoMkz+375IjSOLwl58SGbeXiXr0nZ9TwIDAQAB -o4IBKDCCASQwHQYDVR0OBBYEFD+2guJpWXnMOdLVUSeO4KZZ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9M3yZRox7XnmZy3slYC2V2yS -3w+NQzq8iBwsGKKXpIxUQ9+A7/IzCPn5BlzSKAI8ygnD5MqiRzCmjyvxdsrZlwvk -lBdVL0E5pfS8Fg== ------END CERTIFICATE----- \ No newline at end of file diff --git a/src/main/event-listeners.ts b/src/main/event-listeners.ts index 8ef0d40..9158c73 100644 --- a/src/main/event-listeners.ts +++ b/src/main/event-listeners.ts @@ -18,7 +18,7 @@ import { IPC_GET_APP_PATH, IPC_GET_PATH, IPC_GET_PROXY, - IPC_READ_CERTIFICATES, + // IPC_READ_CERTIFICATES, IPC_READ_CREDENTIALS, IPC_READ_MAIN_PROCESS_ENVS, IPC_SAVE_CREDENTIALS, @@ -27,7 +27,7 @@ import { import { logger } from '@/main/services/logging'; import { UP_TO_DATE_PROCESS_ENVS } from '@/main/services/env-vars-updater'; import { getSensitiveConfigValues, saveSensitiveConfigValues } from '@/main/services/credentials-manager'; -import { getCertificates } from '@/main/services/read-root-certs'; +// import { getCertificates } from '@/main/services/read-root-certs'; ipcMain.on(IPC_GET_PATH, (event, name) => { event.returnValue = app.getPath(name); @@ -91,11 +91,11 @@ ipcMain.on(IPC_SAVE_CREDENTIALS, async (event, data) => { event.returnValue = await saveSensitiveConfigValues(data); }); -ipcMain.handle(IPC_READ_CERTIFICATES, async () => { - try { - return getCertificates(); - } catch (error) { - logger.error('Error retrieving certificates from trust store:', error); - return []; - } -}); +// ipcMain.handle(IPC_READ_CERTIFICATES, async () => { +// try { +// return getCertificates(); +// } catch (error) { +// logger.error('Error retrieving certificates from trust store:', error); +// return []; +// } +// }); diff --git a/src/main/services/http-client.ts b/src/main/services/http-client.ts index e4036c3..ef31832 100644 --- a/src/main/services/http-client.ts +++ b/src/main/services/http-client.ts @@ -29,17 +29,17 @@ import { ipcRenderer } from 'electron'; const { CookieJar } = require('tough-cookie'); const cookieJar = new CookieJar(); -let trustStoreCertificates: string[] = []; - -ipcRenderer - .invoke(IPC_READ_CERTIFICATES) - .then((certificates) => { - trustStoreCertificates = certificates; - logger.info('Retrieved trust store certificates: ' + trustStoreCertificates.length); - }) - .catch((error) => { - logger.error('Error retrieving trust store certificates:', error); - }); +// let trustStoreCertificates: string[] = []; + +// ipcRenderer +// .invoke(IPC_READ_CERTIFICATES) +// .then((certificates) => { +// trustStoreCertificates = certificates; +// logger.info('Retrieved trust store certificates: ' + trustStoreCertificates.length); +// }) +// .catch((error) => { +// logger.error('Error retrieving trust store certificates:', error); +// }); let gotAdvanced = got; // #!if MOCK_MODE === 'ENABLED' @@ -105,7 +105,7 @@ export const httpClient = async ( }, https: { ...config.https, - certificateAuthority: [...trustStoreCertificates, ...(config?.https?.certificateAuthority || [])], + // certificateAuthority: [...(config?.https?.certificateAuthority || [])], ...putP12Config(url), }, }; diff --git a/src/main/services/p12-certificate-service.ts b/src/main/services/p12-certificate-service.ts index 94df771..590ddd7 100644 --- a/src/main/services/p12-certificate-service.ts +++ b/src/main/services/p12-certificate-service.ts @@ -117,7 +117,7 @@ function getCertsAndKeys(p12: any): CertsAndKeys { } function privateKeyToCert(keys: KeyBag[], cert: P12Certificate): KeyBag | undefined { - return keys.find((keyBag) => keyBag.attributes.localKeyId[0] === cert.attributes.localKeyId[0]); + return keys.find((keyBag) => keyBag?.attributes?.localKeyId?.[0] === cert?.attributes?.localKeyId?.[0]); } function getValidCertsWithKey(certs: P12Certificate[], keys: KeyBag[]): ValidCertsWithKey { diff --git a/tests/resources/certs/example/example-cer.cer b/tests/resources/certs/example/example-cer.cer deleted file mode 100644 index 8e45b95..0000000 --- a/tests/resources/certs/example/example-cer.cer +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFcTCCBFmgAwIBAgIHAXumDkbX3zANBgkqhkiG9w0BAQsFADCBmjELMAkGA1UE -BhMCREUxHzAdBgNVBAoMFmdlbWF0aWsgR21iSCBOT1QtVkFMSUQxSDBGBgNVBAsM -P0luc3RpdHV0aW9uIGRlcyBHZXN1bmRoZWl0c3dlc2Vucy1DQSBkZ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R0T -AQH/BAIwADAgBgNVHSAEGTAXMAoGCCqCFABMBIEjMAkGByqCFABMBE0wHwYDVR0j -BBgwFoAUeunhb+oUWRYF7gPp0/0hq97p2Z4wgYQGBSskCAMDBHsweaQoMCYxCzAJ -BgNVBAYTAkRFMRcwFQYDVQQKDA5nZW1hdGlrIEJlcmxpbjBNMEswSTBHMBcMFcOW -ZmZlbnRsaWNoZSBBcG90aGVrZTAJBgcqghQATAQ2EyEzLVNNQy1CLVRlc3RrYXJ0 -ZS04ODMxMTAwMDAxMjkwNjgwDQYJKoZIhvcNAQELBQADggEBAGwmbkXMdRrIZwTz -UVsdH6RUB7cc3+CcDN0NqLSOM7sdCQrr5NfzcK2dzhc77KVzviZbvz6MxfEq47Y/ -dPMmtVlU0Amw5bbnYT4WnadjrLOHnKCxLFssrfo0izB7IJvBswMQl/KnUXbk/X57 -KcNKTYOfuCVVVt+yET63N4qp9YOPiMdCHxu+BUvgwmOgr/enRnh+HgCYVQtzLmDX -imBcneRoZg3XgukoMQPd5TlVlZAF1JZ6W8uGN+LEiddnHdzYFVInest3xMzwHj4T -3lXLCkr6oc9jvwKe2A2qsBvcbEFDR0mi0CW9NjfJ05v/52GKZZZyjEnFjnHJ1J5r -1DlD5S8= ------END CERTIFICATE----- diff --git a/tests/resources/certs/example/example-key.cer b/tests/resources/certs/example/example-key.cer deleted file mode 100644 index d28911d..0000000 --- a/tests/resources/certs/example/example-key.cer +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIFcTCCBFmgAwIBAgIHAXumDkbX3zANBgkqhkiG9w0BAQsFADCBmjELMAkGA1UE -BhMCREUxHzAdBgNVBAoMFmdlbWF0aWsgR21iSCBOT1QtVkFMSUQxSDBGBgNVBAsM -P0luc3RpdHV0aW9uIGRlcyBHZXN1bmRoZWl0c3dlc2Vucy1DQSBkZXIgVGVsZW1h -dGlraW5mcmFzdHJ1a3R1cjEgMB4GA1UEAwwXR0VNLlNNQ0ItQ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0j -BBgwFoAUeunhb+oUWRYF7gPp0/0hq97p2Z4wgYQGBSskCAMDBHsweaQoMCYxCzAJ -BgNVBAYTAkRFMRcwFQYDVQQKDA5nZW1hdGlrIEJlcmxpbjBNMEswSTBHMBcMFcOW -ZmZlbnRsaWNoZSBBcG90aGVrZTAJBgcqghQATAQ2EyEzLVNNQy1CLVRlc3RrYXJ0 -ZS04ODMxMTAwMDAxMjkwNjgwDQYJKoZIhvcNAQELBQADggEBAGwmbkXMdRrIZwTz -UVsdH6RUB7cc3+CcDN0NqLSOM7sdCQrr5NfzcK2dzhc77KVzviZbvz6MxfEq47Y/ -dPMmtVlU0Amw5bbnYT4WnadjrLOHnKCxLFssrfo0izB7IJvBswMQl/KnUXbk/X57 -KcNKTYOfuCVVVt+yET63N4qp9YOPiMdCHxu+BUvgwmOgr/enRnh+HgCYVQtzLmDX -imBcneRoZg3XgukoMQPd5TlVlZAF1JZ6W8uGN+LEiddnHdzYFVInest3xMzwHj4T -3lXLCkr6oc9jvwKe2A2qsBvcbEFDR0mi0CW9NjfJ05v/52GKZZZyjEnFjnHJ1J5r -1DlD5S8= ------END ENCRYPTED PRIVATE KEY----- \ No newline at end of file diff --git a/tests/resources/certs/kops/gen13-cert.pem b/tests/resources/certs/kops/gen13-cert.pem deleted file mode 100644 index 9216f46..0000000 --- a/tests/resources/certs/kops/gen13-cert.pem +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDczCCAlugAwIBAgIEEN0N0DANBgkqhkiG9w0BAQsFADBAMRgwFgYDVQQDDA9D -bGllbnQtU3lzdGVtLXgxFzAVBgNVBAoMDmVIZWFsdGhFeHBlcnRzMQswCQYDVQQG -EwJERTAeFw0yMTA2MzAxOTI3MzlaFw0yNDA2MjkxOTI3MzlaMEAxGDAWBgNVBAMM -D0NsaWVudC1TeXN0ZW0teDEXMBUGA1UECgwOZUhlYWx0aEV4cGVydHMxCzAJBgNV -BAYTAkRFMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj+zW8xQfcsAo -7I10wPsBt6ph7s6JmHjj3DWeszqJTNGxQCp3R+K7pfF+lC0F9B1eBYlmFbzh7KJ0 -nt6c/zwfcK7Rl2XE+Jm2z45Pr+J9jcPJROADbXPj1ROzRvfKXCZgmcWRmjIQMkEk -2yawgtbiwK3Or/xPuwk4dShZFZgivT0xgA1g2PFVPQWj8gmDrnauwgfhhE956e9r -79QwFz8NKaJIjYGA9P7CRGy3V0KpSMCi97k/Ou/fRudSgARn9bgx1KCKcbjEmLaV -XPb5BNGPv+jzcBRnzBMft7pMwxNxqN04bowVuiD8lE5PpVrkdrzr+xD68pIM+rjj -7hFbPma13wIDAQABo3UwczAfBgNVHSMEGDAWgBQhCERFQGJ29YSBb6SrN+lOZISV -5DAdBgNVHQ4EFgQUIQhERUBidvWEgW+kqzfpTmSEleQwDAYDVR0TAQH/BAIwADAO -BgNVHQ8BAf8EBAMCA+gwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEL -BQADggEBAECIokIxK2DGLnTWZPid5Mc0deFuglPS65QGCFMtm39N64dQ18CVCAHx -AdJ7EfBdeWWHgH94zGe7mDqK8ZtEBA79uQN4urnZLq74dsHYMC0/OnYRwmrNnE27 -V776I2zqphoCWPv5TFdbpry4ODQ6P6DMINM2VfECy+KX6MG24Oq4CLJnn2gtl8z8 -8r8T6XRyflNAvu6WKaB5aqNEs/btmFt9CXrQ3zj3rh5xzErEnToKLPBjCdD4fkM9 -GRbSJTdVALv0qLzUnntTFjAqyBNzIWxTKVEOl7KlX+qBClCB/Q/b325knMyLoH3Q -+Tt8n/29WoHyzzGFUTIX0HHraH9illI= ------END CERTIFICATE----- \ No newline at end of file diff --git a/tests/resources/certs/kops/gen13-key.pem b/tests/resources/certs/kops/gen13-key.pem deleted file mode 100644 index 15af53d..0000000 --- a/tests/resources/certs/kops/gen13-key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY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IW/i1kHN0PG1f9ZIfvtiaE/5lcaxOVOiOg1kO0hrMw9a/r -PoPJU/nHbwKBgHnlciU1odE6NxxV1gIyDa/ykk2X2nLz1ltN8MkztIHZO9v9+RqE -hcjuNYxl2kryCAKmTh/LOBQN8kBb6EHfN9cJyrttZXCCKTGR1496o64Mfw3ElP9I -iQZL9yEr6LZD5TzwITNzSBkhtFruvAoAeLyb5yjmQPUGW01Svn9reoKxAoGBAI11 -x3Y31Kj9waXpfvPTs6YDgtoRKjY7Rk6dwcK6c16xHgDyOZJ7R/SsTwZO9n41JTHX -ygJdRAEo+EfE7do1wTGCnK/5f9qWMdiBtE3J5S5oS04EONbVXwkwcng2S6uqBhiU -wJO0mZtGJamEI8HpUxLRjSgf8q6R6TGhUGV7DZE1AoGAcQMJ/fd6DTtRFoBFht94 -/V38P+JJ55FZJrWrW2JltDoM4puLPLT+0UtLDMudg7L9koA9v2shX9zzvHV8gizY -FVJFe1p7S8VlCgAWR4+QTBnEnmlJ5EjhbWp/rlY+t7/V9fn+7dE547oq36fmdYRm -vFsnL35zrUjgIBSGerPH4iQ= ------END PRIVATE KEY----- \ No newline at end of file diff --git a/tests/resources/certs/kops/generated-truststore3.p12 b/tests/resources/certs/kops/generated-truststore3.p12 deleted file mode 100644 index 7b6a49f..0000000 Binary files a/tests/resources/certs/kops/generated-truststore3.p12 and /dev/null differ diff --git a/tests/resources/certs/kops/r3.pem b/tests/resources/certs/kops/r3.pem deleted file mode 100644 index 43b222a..0000000 --- a/tests/resources/certs/kops/r3.pem +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw -TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh -cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw -WhcNMjUw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AvnnAT45tRAxekrsu94sQ4egdRCnbWSDtY7kh+BIm -lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4 -avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2 -yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O -yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids -hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+ -HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv -MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX -nLRbwHOoq7hHwg== ------END CERTIFICATE----- diff --git a/tests/unit/__snapshots__/base-template.spec.ts.snap b/tests/unit/__snapshots__/base-template.spec.ts.snap index 1700fe1..fe2ae73 100644 --- a/tests/unit/__snapshots__/base-template.spec.ts.snap +++ b/tests/unit/__snapshots__/base-template.spec.ts.snap @@ -63,7 +63,7 @@ exports[`base template screen render with settings button 1`] = `
Version dev
diff --git a/tests/unit/modules/settings/settings-validation.spec.ts b/tests/unit/modules/settings/settings-validation.spec.ts deleted file mode 100644 index c55a2fe..0000000 --- a/tests/unit/modules/settings/settings-validation.spec.ts +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright 2024 gematik GmbH - * - * The Authenticator App is licensed under the European Union Public Licence (EUPL); every use of the Authenticator App - * Sourcecode must be in compliance with the EUPL. - * - * You will find more details about the EUPL here: https://joinup.ec.europa.eu/collection/eupl - * - * Unless required by applicable law or agreed to in writing, software distributed under the EUPL is distributed on an "AS - * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the EUPL for the specific - * language governing permissions and limitations under the License.ee the Licence for the specific language governing - * permissions and limitations under the Licence. - */ - -import { P12_VALIDITY_TYPE } from '@/constants'; -import Swal from 'sweetalert2'; -import fs from 'fs'; - -import { mount } from '@vue/test-utils'; -import { SettingsScreen } from '@/renderer/modules/settings'; -import i18n from '@/renderer/i18n'; -import store from '@/renderer/store'; -import { FileStorageRepository } from '@/renderer/modules/settings/repository'; -import { clearSampleData, setSampleData } from '@tests/utils/config-sample-data'; -import { ENTRY_OPTIONS_CONFIG_GROUP } from '@/config'; -import { PathProvider } from '@/renderer/service/path-provider'; -import { getHomedir } from '@/renderer/modules/connector/common/utils'; -import { - copyUploadedFileToTargetDir, - getCaCertsWithFilenames, - getUploadedFilePath, -} from '@/renderer/utils/read-tls-certificates'; -import { UserfacingError } from '@/renderer/errors/errors'; -import { checkPemFileFormat, checkPemFileFormatSilent, PEM_TYPES } from '@/renderer/utils/pem-file-validator'; -import { certsValidityTest } from '@/renderer/modules/settings/services/test-cases/certs-validity-test'; -import { TestStatus } from '@/renderer/modules/settings/services/test-runner'; -import { preloadApi } from '@/main/preload-api'; -import { isMacOS } from '@tests/utils'; -import os from 'os'; - -jest.mock('sweetalert2', () => ({ - fire: jest.fn().mockReturnValue({ isConfirmed: true }), -})); - -PathProvider.setSystemUserTempPath(getHomedir()); -const TEST_FILE_PATH_TO_KEY = process.cwd() + '/tests/resources/certs/example/example-key.cer'; -const TEST_FILE_PATH = process.cwd() + '/tests/resources/certs/example/example-cer.cer'; -const TEST_FILE_PATH_PFX = process.cwd() + '/tests/resources/certs/example/cs0001.p12'; -const TEST_FILE_PATH_ONLY_ECC_PFX = process.cwd() + '/tests/resources/certs/example/cs0001_ECC.p12'; -const TEST_FILE_PATH_OUTDATED_PFX = process.cwd() + '/tests/resources/certs/example/smcb-idp-expired.p12'; -const TEST_FILE_PATH_INVALID_AND_EMPTY_PFX = - process.cwd() + '/tests/resources/certs/example/cert_invalid_and_empty.p12'; -const TEST_FILE_PATH_RSA_AND_ECC_PFX = process.cwd() + '/tests/resources/certs/example/cs0001_RSA_ECC.p12'; -const TEST_FILE_PATH_WITH_TOO_MANY_PFX = process.cwd() + '/tests/resources/certs/example/cert_with_more_than_one_rsa'; -const TEST_FILE_PATH_EMPTY_PFX = process.cwd() + '/tests/resources/certs/example/cert_empty'; - -const contentKey = fs.readFileSync(TEST_FILE_PATH_TO_KEY); -const contentCert = fs.readFileSync(TEST_FILE_PATH); - -jest.spyOn(FileStorageRepository as any, 'saveToCm').mockReturnValue(true); - -if (isMacOS()) { - jest.spyOn(window.api, 'sendSync').mockReturnValue(os.homedir()); -} - -const fileStorageRepository = new FileStorageRepository(); -jest.mock('@/renderer/modules/settings/useSettings.ts', () => ({ - useSettings: () => { - return fileStorageRepository; - }, -})); - -describe('settings page validation', () => { - afterAll(() => { - clearSampleData(); - }); - - const valueNotValidText = 'Wert ist nicht gültig!'; - it('no validation error appears ', async function () { - setSampleData(); - const wrapper = await mount(SettingsScreen, { - global: { - plugins: [store, i18n], - }, - }); - - expect(wrapper.element?.textContent?.includes(valueNotValidText)).toBeFalsy(); - }); - - it('validation error appears ', async function () { - // @ts-ignore - setSampleData({ [ENTRY_OPTIONS_CONFIG_GROUP.PORT]: 'wrong-port-data' }); - const wrapper = await mount(SettingsScreen, { - global: { - plugins: [store, i18n], - }, - }); - - expect(wrapper.element?.textContent?.includes(valueNotValidText)).toBeTruthy(); - }); - - it('validation error blocks saving the form', async function () { - jest - .spyOn(Swal, 'fire') - .mockResolvedValue({ isConfirmed: true, value: '123456', isDenied: false, isDismissed: false }); - - // @ts-ignore - setSampleData({ [ENTRY_OPTIONS_CONFIG_GROUP.PORT]: 'wrong-port-data' }); - const wrapper = await mount(SettingsScreen, { - global: { - plugins: [store, i18n], - }, - }); - - expect(await wrapper.vm.saveConfigValues()).toBe(false); - expect(Swal.fire).toHaveBeenCalledTimes(1); - expect(Swal.fire).toHaveBeenCalledWith({ - icon: 'warning', - title: 'Bitte geben Sie einen korrekten Eingabewert ein!', - confirmButtonText: 'OK', - }); - }); - - it('validation that uploading key and cert files keep their names', async function () { - fs.mkdirSync(PathProvider.configPath, { recursive: true }); - expect( - await copyUploadedFileToTargetDir(TEST_FILE_PATH, ENTRY_OPTIONS_CONFIG_GROUP.TLS_PRIVATE_KEY, 'example-cer.cer'), - ).toBe(getUploadedFilePath('example-cer.cer')); - - expect( - await copyUploadedFileToTargetDir(TEST_FILE_PATH, ENTRY_OPTIONS_CONFIG_GROUP.TLS_CERTIFICATE, 'example-cer.cer'), - ).toBe(getUploadedFilePath('example-cer.cer')); - }); - - it('validation that invalid uploading key and cert files throws an error', async function () { - /* @ts-ignore this is a negative test*/ - await expect(copyUploadedFileToTargetDir(TEST_FILE_PATH, 'wrong entry option', 'example-cer.cer')).rejects.toThrow( - `Error: selected file ${TEST_FILE_PATH} is not in PEM-Format`, - ); - }); - const fileKeyString = contentKey.toString(); - const fileCertString = contentCert.toString(); - - it('Confirmation that the Key.pem file has the right format.', async function () { - await expect(checkPemFileFormat(fileKeyString, PEM_TYPES.KEY)).resolves.not.toThrow(UserfacingError); - }); - - it('Confirmation that the Key.pem file throws an error', async function () { - await expect(checkPemFileFormat('hallo', PEM_TYPES.KEY)).rejects.toThrow(UserfacingError); - }); - - it('Confirmation that the Cert.pem file has the right format.', async function () { - await expect(checkPemFileFormat(fileCertString, PEM_TYPES.CERT)).resolves.not.toThrow(UserfacingError); - }); - - it('Confirmation that the Cert file throws an error', async function () { - await expect(checkPemFileFormat('hallo', PEM_TYPES.CERT)).rejects.toThrow(UserfacingError); - }); - - it('Confirmation that the Cert file is valid', async function () { - await expect(checkPemFileFormatSilent(fileCertString, PEM_TYPES.CERT)).resolves.toBeTruthy(); - }); - - it('Confirmation that the Cert file is not valid', async function () { - await expect(checkPemFileFormatSilent('hallo', PEM_TYPES.CERT)).resolves.toBeFalsy(); - }); - - it('There should be some filenames of certs found', async function () { - await expect(getCaCertsWithFilenames(true).length).toBeGreaterThan(2); - }); - - it('Certs Validity Function Test', async function () { - const resp = await certsValidityTest(); - expect(resp.status).toBe(TestStatus.success); - }); - it('Negative - Certs Validity Function Test', async function () { - // create one invalid cert in the PathProvider.caCertificatePath(isConnector) folder - const caCertificatePath = PathProvider.caCertificatePath(false); - const invalidCertPath = caCertificatePath + '/invalid_cert.pem'; - fs.writeFileSync(invalidCertPath, 'invalid cert content'); - - try { - const resp = await certsValidityTest(); - console.log('custom resp', resp); - expect(resp.details).toBe( - 'Es wurden insgesamt 29 Zertifikate gefunden, davon 1 fehlerhaft. Bitte überprüfen Sie die folgenden Zertifikate:
- invalid_cert.pem', - ); - } catch (e) { - console.log('custom error', e); - expect(e).toBe('Test failed'); - } finally { - // remove the invalid cert - fs.unlinkSync(invalidCertPath); - } - }); - it('validation that uploading pfx-file keep their name', async function () { - fs.mkdirSync(PathProvider.configPath, { recursive: true }); - expect( - await copyUploadedFileToTargetDir( - TEST_FILE_PATH_PFX, - ENTRY_OPTIONS_CONFIG_GROUP.TLS_PFX_CERTIFICATE, - 'cs0001.p12', - ), - ).toBe(getUploadedFilePath('cs0001.p12')); - }); - it('validation that valid uploading pfx-file is successful', async function () { - expect(preloadApi.isP12Valid(TEST_FILE_PATH_PFX, '123456')).toBe(P12_VALIDITY_TYPE.VALID); - }); - it('validation that outdated uploading pfx-file throws an error', async function () { - await expect(preloadApi.isP12Valid(TEST_FILE_PATH_OUTDATED_PFX, '00')).toBe(P12_VALIDITY_TYPE.INVALID_CERTIFICATE); - }); - it('validation that uploading a pfx-file with wrong password throws an error', async function () { - await expect(preloadApi.isP12Valid(TEST_FILE_PATH_PFX, 'wrong password')).toBe(P12_VALIDITY_TYPE.WRONG_PASSWORD); - }); - it('validation that invalid uploading pfx-file throws an error', async function () { - await expect(preloadApi.isP12Valid(TEST_FILE_PATH_ONLY_ECC_PFX, '123456')).toBe( - P12_VALIDITY_TYPE.INVALID_CERTIFICATE, - ); - }); - it('validation that an invalid/empty uploading pfx-file throws an error', async function () { - await expect(preloadApi.isP12Valid(TEST_FILE_PATH_INVALID_AND_EMPTY_PFX, '')).toBe( - P12_VALIDITY_TYPE.PROCESSING_EXCEPTION, - ); - }); - it('validation that an pfx-file with one valid and invalid certs throws a hint', async function () { - await expect(preloadApi.isP12Valid(TEST_FILE_PATH_RSA_AND_ECC_PFX, '123456')).toBe( - P12_VALIDITY_TYPE.ONE_VALID_AND_INVALID_CERTIFICATES, - ); - }); - it('validation that an pfx-file with more than one valid certs throws an error', async function () { - await expect(preloadApi.isP12Valid(TEST_FILE_PATH_WITH_TOO_MANY_PFX, '123456')).toBe( - P12_VALIDITY_TYPE.TOO_MANY_CERTIFICATES, - ); - }); - it('validation that an empty pfx-file throws an error', async function () { - await expect(preloadApi.isP12Valid(TEST_FILE_PATH_EMPTY_PFX, '123456')).toBe(P12_VALIDITY_TYPE.NO_CERT_FOUND); - }); -});