From 52fa36327498bf1394970ef7572142b8a69ec304 Mon Sep 17 00:00:00 2001 From: Paramesh Babu Date: Mon, 13 May 2019 12:17:24 -0700 Subject: [PATCH] Tools version 6.0.190307.1402 - minor addition Test-IoTCerts (#316) * Adding Test Cert method * Fix build error for missing conditional feature for SMBIOS_DEFAULT --- Tools/IoTCoreImaging/IoTCoreImaging.psd1 | 8 +- Tools/IoTCoreImaging/IoTCoreImaging.psm1 | 1 + Tools/IoTCoreImaging/IoTTestCommands.ps1 | 53 +++ .../BSP/QCDB410C/Packages/QCDB410CFM.xml | 359 +++++++++--------- 4 files changed, 237 insertions(+), 184 deletions(-) diff --git a/Tools/IoTCoreImaging/IoTCoreImaging.psd1 b/Tools/IoTCoreImaging/IoTCoreImaging.psd1 index d28f4b5f..11c4f5df 100644 --- a/Tools/IoTCoreImaging/IoTCoreImaging.psd1 +++ b/Tools/IoTCoreImaging/IoTCoreImaging.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 1/16/2019 +# Generated on: 3/7/2019 # @{ @@ -12,7 +12,7 @@ RootModule = 'IoTCoreImaging.psm1' # Version number of this module. -ModuleVersion = '6.0.190116.1218' +ModuleVersion = '6.0.190307.1402' # Supported PSEditions # CompatiblePSEditions = @() @@ -98,7 +98,7 @@ FunctionsToExport = 'New-IoTFIPPackage', 'New-IoTFFUImage', 'New-IoTCabPackage', 'Import-IoTCertificate', 'Add-IoTDeviceGuard', 'Add-IoTSecureBoot', 'Add-IoTBitLocker', 'New-IoTOEMCerts', 'Install-IoTOEMCerts', 'Add-IoTProductFeature', 'Remove-IoTProductFeature', 'Import-QCBSP', - 'New-IoTInf2Cab' + 'New-IoTInf2Cab', 'Test-IoTCerts' # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() @@ -115,7 +115,7 @@ AliasesToExport = 'addenv', 'buildfm', 'buildimage', 'buildpkg', 'buildppkg', 'b 'newcommonpkg', 'newdrvpkg', 'newproduct', 'open-ws', 're-signcabs', 'retailsign', 'setenv', 'setsignature', 'setversion', 'signbinaries', 'tfids', 'tpkgs', 'verifyrecovery', 'newprovpkg', 'gwsproducts', 'gwsbsps', - 'addfid', 'removefid', 'inf2cab' + 'addfid', 'removefid', 'inf2cab', 'tcerts' # DSC resources to export from this module # DscResourcesToExport = @() diff --git a/Tools/IoTCoreImaging/IoTCoreImaging.psm1 b/Tools/IoTCoreImaging/IoTCoreImaging.psm1 index ddbb8472..c0c41aec 100644 --- a/Tools/IoTCoreImaging/IoTCoreImaging.psm1 +++ b/Tools/IoTCoreImaging/IoTCoreImaging.psm1 @@ -46,6 +46,7 @@ New-Alias -Name 'buildppkg' -Value 'New-IoTProvisioningPackage' New-Alias -Name 'convertpkg' -Value 'Convert-IoTPkg2Wm' New-Alias -Name 'tfids' -Value 'Test-IoTFeatures' New-Alias -Name 'tpkgs' -Value 'Test-IoTPackages' +New-Alias -Name 'tcerts' -Value 'Test-IoTCerts' New-Alias -Name 'importcfg' -Value 'Import-IoTDUCConfig' New-Alias -Name 'exportpkgs' -Value 'Export-IoTDUCCab' New-Alias -Name 'exportidm' -Value 'Export-IoTDeviceModel' diff --git a/Tools/IoTCoreImaging/IoTTestCommands.ps1 b/Tools/IoTCoreImaging/IoTTestCommands.ps1 index f5040b0b..8b272ddb 100644 --- a/Tools/IoTCoreImaging/IoTTestCommands.ps1 +++ b/Tools/IoTCoreImaging/IoTTestCommands.ps1 @@ -173,6 +173,59 @@ function Test-IoTSignature { return $retval } +function Test-IoTCerts { + <# + .SYNOPSIS + Checks if the certs in the workspace folder are all valid. + + .DESCRIPTION + Checks if the certs in the workspace folder are all valid. + + .INPUTS + None + + .OUTPUTS + System.Boolean + True if the file is properly signed. + + .EXAMPLE + $result = Test-IoTCerts + + .NOTES + This verifies using the Test-Certificate. + + .LINK + [Test-Certificate](https://docs.microsoft.com/powershell/module/pkiclient/test-certificate?view=win10-ps) + #> + [CmdletBinding()] + [OutputType([Boolean])] + Param + ( + + ) + $retval = $true + $certs = Get-ChildItem -Path $env:SRC_DIR, $env:COMMON_DIR -File -Filter *.cer -Recurse | Foreach-Object {$_.FullName} + if ($null -eq $certs) { + Publish-Status "No certs found." + } + $certs = @($certs) + + foreach ($cert in $certs) { + # X509Certificate2 object that will represent the certificate + $certobj = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 + + # Imports the certificate from file to x509Certificate object + $certobj.Import($cert) + $ret = Test-Certificate $certobj -AllowUntrustedRoot + if (!$ret) { + $retval = $false + Publish-Error "$cert is invalid" + } + } + + return $retval +} + function Add-IoTSignature { <# .SYNOPSIS diff --git a/Workspace/Source-arm/BSP/QCDB410C/Packages/QCDB410CFM.xml b/Workspace/Source-arm/BSP/QCDB410C/Packages/QCDB410CFM.xml index 180f891b..a9ba12d5 100644 --- a/Workspace/Source-arm/BSP/QCDB410C/Packages/QCDB410CFM.xml +++ b/Workspace/Source-arm/BSP/QCDB410C/Packages/QCDB410CFM.xml @@ -1,183 +1,182 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QC_UEFI_PRODUCTION - - - - - SBC - - - - - SMBIOS_DEFAULT - - - - - CUSTOM_SMBIOS - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - SBC - - - - - - - - - + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="http://schemas.microsoft.com/embedded/2004/10/ImageUpdate" Revision="1" SchemaVersion="1.2"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + QC_UEFI_PRODUCTION + + + + + SBC + + + + + SMBIOS_DEFAULT + + + + + CUSTOM_SMBIOS + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + SBC + + + + + + + + \ No newline at end of file