From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ml01.01.org (Postfix) with ESMTP id 547A41A1E18 for ; Mon, 15 Aug 2016 01:34:13 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP; 15 Aug 2016 01:34:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,524,1464678000"; d="scan'208";a="1041270532" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 15 Aug 2016 01:34:13 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 15 Aug 2016 01:34:12 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 15 Aug 2016 01:34:11 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.8]) with mapi id 14.03.0248.002; Mon, 15 Aug 2016 16:34:10 +0800 From: "Zhu, Yonghong" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [Patch 1/3] BaseTools: Add the PKCS7 tool Thread-Index: AQHR9s+GLWKPpOK7Ek2HOLlcRuFIS6BJsdCA Date: Mon, 15 Aug 2016 08:34:10 +0000 Message-ID: References: <1471249059-95652-1-git-send-email-yonghong.zhu@intel.com> <1471249059-95652-2-git-send-email-yonghong.zhu@intel.com> <74D8A39837DF1E4DA445A8C0B3885C50028013A9@shsmsx102.ccr.corp.intel.com> In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C50028013A9@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDRkZmI4YzctYzM2ZC00ODQ1LTljODQtOTNjMmM2YjQ3YWNkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlZoXC9XbTBwSDBYS241azJJNEdvQm51dDZvUXhYXC9HYWFJNXV4Y0tlaDlqMD0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch 1/3] BaseTools: Add the PKCS7 tool X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 08:34:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks. I will update it and send a new version. Best Regards, Zhu Yonghong -----Original Message----- From: Yao, Jiewen=20 Sent: Monday, August 15, 2016 4:32 PM To: Zhu, Yonghong ; edk2-devel@lists.01.org Cc: Gao, Liming Subject: RE: [Patch 1/3] BaseTools: Add the PKCS7 tool Hello In order to make PKCS7 tool be consistent with RSA2048SHA256, I suggest we = use "Pkcs7Sign.py" instead of GenFirmwareImageAuthPkcs7.py. > -----Original Message----- > From: Zhu, Yonghong > Sent: Monday, August 15, 2016 4:18 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming ; Yao, Jiewen=20 > > Subject: [Patch 1/3] BaseTools: Add the PKCS7 tool >=20 > Provide the PKCS7 Tool to support the CertType -=20 > EFI_CERT_TYPE_PKCS7_GUID, then user can use this tool to add=20 > EFI_FIRMWARE_IMAGE_AUTHENTICATION for a binary. >=20 > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao > --- > BaseTools/Conf/tools_def.template | 6 + > BaseTools/Source/Python/Makefile | 27 +- > .../Python/Pkcs7Sign/GenFirmwareImageAuthPkcs7.py | 285 > +++++++++++++++++++++ > BaseTools/Source/Python/Pkcs7Sign/TestCert.pem | 57 +++++ > BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem | 19 ++ > BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem | 56 ++++ > BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem | 18 ++ > BaseTools/Source/Python/Pkcs7Sign/TestSub.pem | 57 +++++ > BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem | 19 ++ > 9 files changed, 541 insertions(+), 3 deletions(-) create mode=20 > 100644 BaseTools/Source/Python/Pkcs7Sign/GenFirmwareImageAuthPkcs7.py > create mode 100644 BaseTools/Source/Python/Pkcs7Sign/TestCert.pem > create mode 100644 > BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem > create mode 100644 BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem > create mode 100644 > BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem > create mode 100644 BaseTools/Source/Python/Pkcs7Sign/TestSub.pem > create mode 100644 BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem >=20 > diff --git a/BaseTools/Conf/tools_def.template > b/BaseTools/Conf/tools_def.template > index 974656c..a78ea77 100755 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -7669,10 +7669,16 @@ RELEASE_RVCTCYGWIN_ARM_CC_FLAGS =3D=20 > "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_F ################## > *_*_*_VPDTOOL_PATH =3D BPDG > *_*_*_VPDTOOL_GUID =3D > 8C3D856A-9BE6-468E-850A-24F7A8D38E08 >=20 > ################## > +# Firmware Image Auth PKCS7 tool definitions ################## > +*_*_*_PKCS7_PATH =3D GenFirmwareImageAuthPkcs7 > +*_*_*_PKCS7_GUID =3D > 4AAFD29D-68DF-49EE-8AA9-347D375665A7 > + > +################## > # NASM tool definitions > ################## > *_*_*_NASM_PATH =3D ENV(NASM_PREFIX)nasm > # NASMB uses NASM produce a .bin from a .nasmb NASM source file > *_*_*_NASMB_FLAGS =3D -f bin > diff --git a/BaseTools/Source/Python/Makefile > b/BaseTools/Source/Python/Makefile > index 8bc213b..8d6a386 100644 > --- a/BaseTools/Source/Python/Makefile > +++ b/BaseTools/Source/Python/Makefile > @@ -1,9 +1,9 @@ > ## @file > # Windows makefile for Python tools build. > # > -# Copyright (c) 2010 - 2015, Intel Corporation. All rights=20 > reserved.
> +# Copyright (c) 2010 - 2016, Intel Corporation. All rights=20 > +reserved.
> # This program and the accompanying materials # are licensed and=20 > made available under the terms and conditions of the BSD License #=20 > which accompanies this distribution. The full text of the license may=20 > be found at # http://opensource.org/licenses/bsd-license.php > # > @@ -29,11 +29,11 @@ > MODULES=3Dencodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf > _8,encodings > BASE_TOOLS_PATH =3D $(BASE_TOOLS_PATH::\\=3D:\) EDK_TOOLS_PATH =3D=20 > $(EDK_TOOLS_PATH::\\=3D:\) >=20 > BIN_DIR=3D$(EDK_TOOLS_PATH)\Bin\Win32 >=20 > -APPLICATIONS=3D$(BIN_DIR)\build.exe $(BIN_DIR)\GenFds.exe=20 > $(BIN_DIR)\Trim.exe $(BIN_DIR)\TargetTool.exe $(BIN_DIR)\GenDepex.exe=20 > $(BIN_DIR)\GenPatchPcdTable.exe $(BIN_DIR)\PatchPcdValue.exe=20 > $(BIN_DIR)\BPDG.exe $(BIN_DIR)\UPT.exe=20 > $(BIN_DIR)\Rsa2048Sha256Sign.exe=20 > $(BIN_DIR)\Rsa2048Sha256GenerateKeys.exe $(BIN_DIR)\Ecc.exe > +APPLICATIONS=3D$(BIN_DIR)\build.exe $(BIN_DIR)\GenFds.exe > $(BIN_DIR)\Trim.exe $(BIN_DIR)\TargetTool.exe $(BIN_DIR)\GenDepex.exe=20 > $(BIN_DIR)\GenPatchPcdTable.exe $(BIN_DIR)\PatchPcdValue.exe=20 > $(BIN_DIR)\BPDG.exe $(BIN_DIR)\UPT.exe=20 > $(BIN_DIR)\Rsa2048Sha256Sign.exe=20 > $(BIN_DIR)\Rsa2048Sha256GenerateKeys.exe > $(BIN_DIR)\GenFirmwareImageAuthPkcs7.exe $(BIN_DIR)\Ecc.exe >=20 >=20 > COMMON_PYTHON=3D$(BASE_TOOLS_PATH)\Source\Python\Common\BuildT > oolError.py \ >=20 > $(BASE_TOOLS_PATH)\Source\Python\Common\Database.py \ >=20 > $(BASE_TOOLS_PATH)\Source\Python\Common\DataType.py \ >=20 > $(BASE_TOOLS_PATH)\Source\Python\Common\DecClassObject.py \ @@ -283,11=20 > +283,32 @@ $(BIN_DIR)\Ecc.exe: > $(BASE_TOOLS_PATH)\Source\Python\Ecc\Ecc.py $(CMD_ECC) $(BIN > $(BIN_DIR)\config.ini: $(BASE_TOOLS_PATH)\Source\Python\Ecc\config.ini > @copy /Y /B $(BASE_TOOLS_PATH)\Source\Python\Ecc\config.ini > $(BIN_DIR)\config.ini >=20 > $(BIN_DIR)\exception.xml: > $(BASE_TOOLS_PATH)\Source\Python\Ecc\exception.xml > @copy /Y /B $(BASE_TOOLS_PATH)\Source\Python\Ecc\exception.xml > $(BIN_DIR)\exception.xml > - > + > +$(BIN_DIR)\GenFirmwareImageAuthPkcs7.exe: > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\GenFirmwareImageAuthPk > cs7.py $(BIN_DIR)\TestCert.pem $(BIN_DIR)\TestCert.pub.pem=20 > $(BIN_DIR)\TestRoot.pem $(BIN_DIR)\TestRoot.pub.pem=20 > $(BIN_DIR)\TestSub.pem $(BIN_DIR)\TestSub.pub.pem > + @$(FREEZE) --include-modules=3D$(MODULES) --install-dir=3D$(BIN_DIR) > Pkcs7Sign\GenFirmwareImageAuthPkcs7.py > + > +$(BIN_DIR)\TestCert.pem: > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestCert.pem > + @copy /Y /B > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestCert.pem > $(BIN_DIR)\TestCert.pem > + > +$(BIN_DIR)\TestCert.pub.pem: > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestCert.pub.pem > + @copy /Y /B > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestCert.pub.pem > $(BIN_DIR)\TestCert.pub.pem > + > +$(BIN_DIR)\TestSub.pem: > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestSub.pem > + @copy /Y /B > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestSub.pem > $(BIN_DIR)\TestSub.pem > + > +$(BIN_DIR)\TestSub.pub.pem: > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestSub.pub.pem > + @copy /Y /B > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestSub.pub.pem > $(BIN_DIR)\TestSub.pub.pem > + > +$(BIN_DIR)\TestRoot.pem: > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestRoot.pem > + @copy /Y /B > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestRoot.pem > $(BIN_DIR)\TestRoot.pem > + > +$(BIN_DIR)\TestRoot.pub.pem: > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestRoot.pub.pem > + @copy /Y /B > $(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestRoot.pub.pem > $(BIN_DIR)\TestRoot.pub.pem > + > clean: > cleanall: > @del /f /q $(BIN_DIR)\*.pyd $(BIN_DIR)\*.dll > @for %%i in ($(APPLICATIONS)) do @del /f /q %%i >=20 > diff --git > a/BaseTools/Source/Python/Pkcs7Sign/GenFirmwareImageAuthPkcs7.py > b/BaseTools/Source/Python/Pkcs7Sign/GenFirmwareImageAuthPkcs7.py > new file mode 100644 > index 0000000..ccbb1c2 > --- /dev/null > +++ b/BaseTools/Source/Python/Pkcs7Sign/GenFirmwareImageAuthPkcs7.py > @@ -0,0 +1,285 @@ > +## @file > +# This tool adds EFI_FIRMWARE_IMAGE_AUTHENTICATION for a binary. > +# > +# This tool only support CertType - EFI_CERT_TYPE_PKCS7_GUID > +# {0x4aafd29d, 0x68df, 0x49ee, {0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, > 0x65, 0xa7}} > +# > +# This tool has been tested with OpenSSL. > +# > +# Copyright (c) 2016, Intel Corporation. All rights reserved.
#=20 > +This program and the accompanying materials # are licensed and made=20 > +available under the terms and conditions of the > BSD License > +# which accompanies this distribution. The full text of the license=20 > +may be > found at > +# http://opensource.org/licenses/bsd-license.php > +# > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > +# > + > +''' > +GenFirmwareImageAuth > +''' > + > +import os > +import sys > +import argparse > +import subprocess > +import uuid > +import struct > +import collections > +from Common.BuildVersion import gBUILD_VERSION > + > +# > +# Globals for help information > +# > +__prog__ =3D 'GenFirmwareImageAuthPkcs7' > +__version__ =3D '%s Version %s' % (__prog__, '0.9 ' + gBUILD_VERSION) > +__copyright__ =3D 'Copyright (c) 2016, Intel Corporation. All rights res= erved.' > +__usage__ =3D '%s -e|-d [options] ' % (__prog__) > + > +# > +# GUID for PKCS7 from UEFI Specification # > +WIN_CERT_REVISION =3D 0x0200 > +WIN_CERT_TYPE_EFI_GUID =3D 0x0EF1 > +EFI_CERT_TYPE_PKCS7_GUID =3D > uuid.UUID('{4aafd29d-68df-49ee-8aa9-347d375665a7}') > + > +# > +# typedef struct _WIN_CERTIFICATE { > +# UINT32 dwLength; > +# UINT16 wRevision; > +# UINT16 wCertificateType; > +# //UINT8 bCertificate[ANYSIZE_ARRAY]; # } WIN_CERTIFICATE; # #=20 > +typedef struct _WIN_CERTIFICATE_UEFI_GUID { > +# WIN_CERTIFICATE Hdr; > +# EFI_GUID CertType; > +# //UINT8 CertData[ANYSIZE_ARRAY]; > +# } WIN_CERTIFICATE_UEFI_GUID; > +# > +# typedef struct { > +# UINT64 MonotonicCount; > +# WIN_CERTIFICATE_UEFI_GUID AuthInfo; > +# } EFI_FIRMWARE_IMAGE_AUTHENTICATION; > +# > + > +EFI_FIRMWARE_IMAGE_AUTHENTICATION =3D > collections.namedtuple('EFI_FIRMWARE_IMAGE_AUTHENTICATION', > ['MonotonicCount','dwLength','wRevision','wCertificateType','CertType' > ]) > +EFI_FIRMWARE_IMAGE_AUTHENTICATION_STRUCT =3D > struct.Struct('QIHH16s') > + > +# > +# Filename of test signing private cert that is stored in same=20 > +directory as > this tool > +# > +TEST_SIGNER_PRIVATE_CERT_FILENAME =3D 'TestCert.pem' > +TEST_OTHER_PUBLIC_CERT_FILENAME =3D 'TestSub.pub.pem' > +TEST_TRUSTED_PUBLIC_CERT_FILENAME =3D 'TestRoot.pub.pem' > + > +if __name__ =3D=3D '__main__': > + # > + # Create command line argument parser object > + # > + parser =3D argparse.ArgumentParser(prog=3D__prog__,=20 > +version=3D__version__, > usage=3D__usage__, description=3D__copyright__,=20 > conflict_handler=3D'resolve') > + group =3D parser.add_mutually_exclusive_group(required=3DTrue) > + group.add_argument("-e", action=3D"store_true", dest=3D'Encode', > help=3D'encode file') > + group.add_argument("-d", action=3D"store_true", dest=3D'Decode', > help=3D'decode file') > + parser.add_argument("-o", "--output", dest=3D'OutputFile', type=3Dstr, > metavar=3D'filename', help=3D"specify the output filename", required=3DTr= ue) > + parser.add_argument("--signer-private-cert",=20 > + dest=3D'SignerPrivateCertFile', > type=3Dargparse.FileType('rb'), help=3D"specify the signer private cert f= ilename. > If not specified, a test signer private cert is used.") > + parser.add_argument("--other-public-cert",=20 > + dest=3D'OtherPublicCertFile', > type=3Dargparse.FileType('rb'), help=3D"specify the other public cert fil= ename. > If not specified, a test other public cert is used.") > + parser.add_argument("--trusted-public-cert",=20 > + dest=3D'TrustedPublicCertFile', > type=3Dargparse.FileType('rb'), help=3D"specify the trusted public cert f= ilename. > If not specified, a test trusted public cert is used.") > + parser.add_argument("--monotonic-count", dest=3D'MonotonicCountStr', > type=3Dstr, help=3D"specify the MonotonicCount in FMP capsule. If not=20 > specified, 0 is used.") > + parser.add_argument("--signature-size", dest=3D'SignatureSizeStr',=20 > + type=3Dstr, > help=3D"specify the signature size for decode process.") > + parser.add_argument("-v", "--verbose", dest=3D'Verbose', > action=3D"store_true", help=3D"increase output messages") > + parser.add_argument("-q", "--quiet", dest=3D'Quiet',=20 > + action=3D"store_true", > help=3D"reduce output messages") > + parser.add_argument("--debug", dest=3D'Debug', type=3Dint,=20 > + metavar=3D'[0-9]', > choices=3Drange(0,10), default=3D0, help=3D"set debug level") > + parser.add_argument(metavar=3D"input_file", dest=3D'InputFile', > type=3Dargparse.FileType('rb'), help=3D"specify the input filename") > + > + # > + # Parse command line arguments > + # > + args =3D parser.parse_args() > + > + # > + # Generate file path to Open SSL command # OpenSslCommand =3D=20 > + 'openssl' > + try: > + OpenSslPath =3D os.environ['OPENSSL_PATH'] > + OpenSslCommand =3D os.path.join(OpenSslPath, OpenSslCommand) > + except: > + pass > + > + # > + # Verify that Open SSL command is available # > + try: > + Process =3D subprocess.Popen('%s version' % (OpenSslCommand), > stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.PIPE) > + except: > + print 'ERROR: Open SSL command not available. Please verify PATH > or set OPENSSL_PATH' > + sys.exit(1) > + > + Version =3D Process.communicate() > + if Process.returncode <> 0: > + print 'ERROR: Open SSL command not available. Please verify PATH > or set OPENSSL_PATH' > + sys.exit(Process.returncode) > + print Version[0] > + > + # > + # Read input file into a buffer and save input filename # > + args.InputFileName =3D args.InputFile.name > + args.InputFileBuffer =3D args.InputFile.read() > + args.InputFile.close() > + > + # > + # Save output filename and check if path exists # OutputDir =3D=20 > + os.path.dirname(args.OutputFile) if not os.path.exists(OutputDir): > + print 'ERROR: The output path does not exist: %s' % OutputDir > + sys.exit(1) > + args.OutputFileName =3D args.OutputFile > + > + try: > + if args.MonotonicCountStr.upper().startswith('0X'): > + args.MonotonicCountValue =3D (long)(args.MonotonicCountStr, 16) > + else: > + args.MonotonicCountValue =3D (long)(args.MonotonicCountStr) > + except: > + args.MonotonicCountValue =3D (long)(0) > + > + if args.Encode: > + # > + # Save signer private cert filename and close private cert file > + # > + try: > + args.SignerPrivateCertFileName =3D args.SignerPrivateCertFile.name > + args.SignerPrivateCertFile.close() > + except: > + try: > + # > + # Get path to currently executing script or executable > + # > + if hasattr(sys, 'frozen'): > + Pkcs7ToolPath =3D sys.executable > + else: > + Pkcs7ToolPath =3D sys.argv[0] > + if Pkcs7ToolPath.startswith('"'): > + Pkcs7ToolPath =3D Pkcs7ToolPath[1:] > + if Pkcs7ToolPath.endswith('"'): > + Pkcs7ToolPath =3D RsaToolPath[:-1] > + args.SignerPrivateCertFileName =3D > os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)), > TEST_SIGNER_PRIVATE_CERT_FILENAME) > + args.SignerPrivateCertFile =3D=20 > + open(args.SignerPrivateCertFileName, > 'rb') > + args.SignerPrivateCertFile.close() > + except: > + print 'ERROR: test signer private cert file %s missing' % > (args.SignerPrivateCertFileName) > + sys.exit(1) > + > + # > + # Save other public cert filename and close public cert file > + # > + try: > + args.OtherPublicCertFileName =3D args.OtherPublicCertFile.name > + args.OtherPublicCertFile.close() > + except: > + try: > + # > + # Get path to currently executing script or executable > + # > + if hasattr(sys, 'frozen'): > + Pkcs7ToolPath =3D sys.executable > + else: > + Pkcs7ToolPath =3D sys.argv[0] > + if Pkcs7ToolPath.startswith('"'): > + Pkcs7ToolPath =3D Pkcs7ToolPath[1:] > + if Pkcs7ToolPath.endswith('"'): > + Pkcs7ToolPath =3D RsaToolPath[:-1] > + args.OtherPublicCertFileName =3D > os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)), > TEST_OTHER_PUBLIC_CERT_FILENAME) > + args.OtherPublicCertFile =3D open(args.OtherPublicCertFileName, > 'rb') > + args.OtherPublicCertFile.close() > + except: > + print 'ERROR: test other public cert file %s missing' % > (args.OtherPublicCertFileName) > + sys.exit(1) > + > + format =3D "Q%ds" % len(args.InputFileBuffer) > + FullInputFileBuffer =3D=20 > + struct.pack(format,args.MonotonicCountValue, > args.InputFileBuffer) > + > + # > + # Sign the input file using the specified private key and capture > signature from STDOUT > + # > + Process =3D subprocess.Popen('%s smime -sign -binary -signer "%s" > -outform DER -md sha256 -certfile "%s"' % (OpenSslCommand,=20 > args.SignerPrivateCertFileName, args.OtherPublicCertFileName),=20 > stdin=3Dsubprocess.PIPE, stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.PI= PE) > + Signature =3D Process.communicate(input=3DFullInputFileBuffer)[0] > + if Process.returncode <> 0: > + sys.exit(Process.returncode) > + > + # > + # Write output file that contains Signature, and Input data > + # > + args.OutputFile =3D open(args.OutputFileName, 'wb') > + args.OutputFile.write(Signature) > + args.OutputFile.write(args.InputFileBuffer) > + args.OutputFile.close() > + > + if args.Decode: > + # > + # Save trusted public cert filename and close public cert file > + # > + try: > + args.TrustedPublicCertFileName =3D args.TrustedPublicCertFile.name > + args.TrustedPublicCertFile.close() > + except: > + try: > + # > + # Get path to currently executing script or executable > + # > + if hasattr(sys, 'frozen'): > + Pkcs7ToolPath =3D sys.executable > + else: > + Pkcs7ToolPath =3D sys.argv[0] > + if Pkcs7ToolPath.startswith('"'): > + Pkcs7ToolPath =3D Pkcs7ToolPath[1:] > + if Pkcs7ToolPath.endswith('"'): > + Pkcs7ToolPath =3D RsaToolPath[:-1] > + args.TrustedPublicCertFileName =3D > os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)), > TEST_TRUSTED_PUBLIC_CERT_FILENAME) > + args.TrustedPublicCertFile =3D=20 > + open(args.TrustedPublicCertFileName, > 'rb') > + args.TrustedPublicCertFile.close() > + except: > + print 'ERROR: test trusted public cert file %s missing' % > (args.TrustedPublicCertFileName) > + sys.exit(1) > + > + if not args.SignatureSizeStr: > + print "ERROR: please use the option --signature-size to specify=20 > + the > size of the signature data!" > + sys.exit(1) > + else: > + if args.SignatureSizeStr.upper().startswith('0X'): > + SignatureSize =3D (long)(args.SignatureSizeStr, 16) > + else: > + SignatureSize =3D (long)(args.SignatureSizeStr) > + if SignatureSize < 0: > + print "ERROR: The value of option --signature-size can't be=20 > + set to > negative value!" > + sys.exit(1) > + elif SignatureSize > len(args.InputFileBuffer): > + print "ERROR: The value of option --signature-size is exceed=20 > + the > size of the input file !" > + sys.exit(1) > + > + args.SignatureBuffer =3D args.InputFileBuffer[0:SignatureSize] > + args.InputFileBuffer =3D args.InputFileBuffer[SignatureSize:] > + > + format =3D "Q%ds" % len(args.InputFileBuffer) > + FullInputFileBuffer =3D=20 > + struct.pack(format,args.MonotonicCountValue, > args.InputFileBuffer) > + > + # > + # Save output file contents from input file > + # > + open(args.OutputFileName, 'wb').write(FullInputFileBuffer) > + > + # > + # Verify signature > + # > + Process =3D subprocess.Popen('%s smime -verify -inform DER > -content %s -CAfile %s' % (OpenSslCommand, args.OutputFileName,=20 > args.TrustedPublicCertFileName), stdin=3Dsubprocess.PIPE,=20 > stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.PIPE) > + Process.communicate(input=3Dargs.SignatureBuffer)[0] > + if Process.returncode <> 0: > + print 'ERROR: Verification failed' > + os.remove (args.OutputFileName) > + sys.exit(Process.returncode) > + > + open(args.OutputFileName, 'wb').write(args.InputFileBuffer) > diff --git a/BaseTools/Source/Python/Pkcs7Sign/TestCert.pem > b/BaseTools/Source/Python/Pkcs7Sign/TestCert.pem > new file mode 100644 > index 0000000..7e10358 > --- /dev/null > +++ b/BaseTools/Source/Python/Pkcs7Sign/TestCert.pem > @@ -0,0 +1,57 @@ > +Bag Attributes > + localKeyID: 01 00 00 00 > + Microsoft CSP Name: Microsoft Strong Cryptographic Provider > + friendlyName: PvkTmp:133cc061-112c-467a-b8cf-dc0a56d7830e > +Key Attributes > + X509v3 Key Usage: 80 > +-----BEGIN PRIVATE KEY----- > +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSPHYSohF > +fim4 > +89iNx8CcCG/fPb7KLu9Dsq+pB4Pc/UJtaaA+D7RK3PhqNCrWbb+gCNgm7lxiO > CrH > +mm0tPal71UV8VFUiTM7Zf1y8VBFCHJ92ykmS7MDwqV25oMGGocz4jdcPl3r > 2yFFq > +d9jaBAPjUsHRbs8AC8CKHexOACfeydgQoj9KPWH9DUFQyXcbtMyGXAvFCktn > SNRQ > +f01UdNJebeD6+wlQn0sUaojn1lu570OdZ3AkJlm6bTEKvfHeOB21GaHnQ1O1 > RVtq > +vd/KjFHhxSSw8meTsyqN/Toa/80FyUKEmTIaJdEaq/C2XKaUACezsYqvRxDq+p > li > +kyiIpt6bAgMBAAECggEAEeqpdrf3l71iZEAwCJLwNM3N0xawEPp2Ix+56OY8U > C+R > +W3FlCiWHa+Kt5uk0VGhG4Zcj0IVEuV3zU9hGRxQ2dy8Wn9h/Q8AQWdKCbKq > KIMT7 > +/qRjJkauju3ZR1x8SX/6anuKXWUsUh8R5o7/eRqj1U6242+FmhZWhTWMVbQ > sLl3y > +AShlw56zwdto543Ssl+MLuUtkxT4UZwmo6k/BucvdYsvwWp8dAluhDp2onAf > OMLn > +10Bk3Bl9AgnpcQEeGwFConmgBv31UhdYftfIj2R4tTZRDuC+GzRT6jl1Qu6JfPS > p > +30tmW5x3aa3946VZw2DKNiBqqYllJM1+kkzmGj+jgQKBgQC1Pzl8gv3q2TH9 > MlTD > +Tn9rUEs5OhjCrgZrSXoY2rfLcqJf2Tqm6I4xsVXvuePMyu8+DRD1Xizq6otUzNs > N > +qh+UVkGRrFYRsgCgv1ratUti2ZlIPrR3JZsz8f23TAMGFFWCNHDH2rb1UanRD+ > g8 > +vO4fQM8FPxBfb6wcgDYqNNMdGwKBgQDOjKhqp5sNNXNF7/rfH6H8RfKVO > XuCK1Xy > +PU3Hgzd1wMfoebku4j5zQi2topzy664k9oeLCJj4GNDeHAqMttWD6TzDlMGJf > dnj > +bNcrr+HnqUXByU2kS+bcTgBzsyT/1m1M7pKwtSYJzYXP1AHQny3Ip5kutCMo1 > 9td > +R4LfdebcgQKBgF3CHQzJ/mw0euWN2cdGnid3W9J4uUJMH8n0MpMU4ar+2 > /xVNUAO > +YTBXmirusGbKO8SPocwsMXQ8bGMrrc19yeREUpr22XdB6408L9WfnyW9hsu > WlGhm > +LclLT4I4cf/9GNbIJedcvvRckEozvmFdIplMP0tpeiDEdfYwZNSkiuktAoGBAL5m > +gTXYDSFO/VUiFFOsOElyPV174LOsuQyVoGZjOjOtI1rVInTqkAD1p1/hf+aahSy > D > +qYzrvv8s+RVWKg9u10JDNgVg0kupHLr98RfPiWJg8vHhXFYwtb6tlNMS9+9yvc > zm > +O4jzY/4zW7+qQoYKxkyq2pVn7uVOnmPNcQIHEGqBAoGBAJMfZV2vpxY6kti8 > SXzb > +PscYI3ZbbKyJLq4+KHGcKCqqbLiY4ao8vflDyDwBm+TJg4xq9wjJAN2riE9nuuds > +99mYW/8R30BIfiH/4oBHjggb0NC5K3vHR4KGDKcUiIKZPv1r7mNeYw227N4n > /dPM > +NXjlZVuS6mqc2T+GPzAJj/Uf > +-----END PRIVATE KEY----- > +Bag Attributes > + localKeyID: 01 00 00 00 > +subject=3D/CN=3DTestCert > +issuer=3D/CN=3DTestSub > +-----BEGIN CERTIFICATE----- > +MIIC/TCCAemgAwIBAgIQ0+nLBVt+jbJMSfzhFpRJrDAJBgUrDgMCHQUAMBIx > EDAO > +BgNVBAMTB1Rlc3RTdWIwHhcNMTYwODA0MTUwMjMwWhcNMzkxMjMx > MjM1OTU5WjAT > +MREwDwYDVQQDEwhUZXN0Q2VydDCCASIwDQYJKoZIhvcNAQEBBQADggE > PADCCAQoC > +ggEBAJI8dhKiEX5+Kbjz2I3HwJwIb989vsou70Oyr6kHg9z9Qm1poD4PtErc+Go > 0 > +KtZtv6AI2CbuXGI4KseabS09qXvVRXxUVSJMztl/XLxUEUIcn3bKSZLswPCpXbm > g > +wYahzPiN1w+XevbIUWp32NoEA+NSwdFuzwALwIod7E4AJ97J2BCiP0o9Yf0N > QVDJ > +dxu0zIZcC8UKS2dI1FB/TVR00l5t4Pr7CVCfSxRqiOfWW7nvQ51ncCQmWbpt > MQq9 > +8d44HbUZoedDU7VFW2q938qMUeHFJLDyZ5OzKo39Ohr/zQXJQoSZMhol0R > qr8LZc > +ppQAJ7Oxiq9HEOr6mWKTKIim3psCAwEAAaNWMFQwDAYDVR0TAQH/BAIw > ADBEBgNV > +HQEEPTA7gBAeQOcW6KCBdWSbrvKQrBrfoRUwEzERMA8GA1UEAxMIVGVz > dFJvb3SC > +ELOMZKZtPz2BS8i5NTXdHNMwCQYFKw4DAh0FAAOCAQEAK7YgK6iiTo07d3C > SY4xG > +9N0QS2m4LsBPrF8pFmk5h6R81MFEdBZrA+zggbUujQ2IGB7k6F7WvP3F3B3 > AXZtx > +DW1FYrQheQhTT5wx85LxFdLy+q6uwUtJi/VyErPmZOcds3QaBXPvG/UykFbu > 24JV > +K2ScLpQVyzmkTN7GWSXrIO6eHHMQgeRX3XjRutbR8CKP1pWTOY+MO4G6Y > ZqrzLdp > +opYFPgvdZpTL3IKSSkp31Amu5oidkvzLgallC3SOYdLZirWEIAAXW2LVYXwiiL6L > +HEIV/G9u85jhKhv/z9l8F/1Eg4HHGSYba8pf1HQA+WsQwi4BVp4x4MBoeHOol > yVT > +/A=3D=3D > +-----END CERTIFICATE----- > diff --git a/BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem > b/BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem > new file mode 100644 > index 0000000..f5b0cec > --- /dev/null > +++ b/BaseTools/Source/Python/Pkcs7Sign/TestCert.pub.pem > @@ -0,0 +1,19 @@ > +-----BEGIN CERTIFICATE----- > +MIIC/TCCAemgAwIBAgIQ0+nLBVt+jbJMSfzhFpRJrDAJBgUrDgMCHQUAMBIx > EDAO > +BgNVBAMTB1Rlc3RTdWIwHhcNMTYwODA0MTUwMjMwWhcNMzkxMjMx > MjM1OTU5WjAT > +MREwDwYDVQQDEwhUZXN0Q2VydDCCASIwDQYJKoZIhvcNAQEBBQADggE > PADCCAQoC > +ggEBAJI8dhKiEX5+Kbjz2I3HwJwIb989vsou70Oyr6kHg9z9Qm1poD4PtErc+Go > 0 > +KtZtv6AI2CbuXGI4KseabS09qXvVRXxUVSJMztl/XLxUEUIcn3bKSZLswPCpXbm > g > +wYahzPiN1w+XevbIUWp32NoEA+NSwdFuzwALwIod7E4AJ97J2BCiP0o9Yf0N > QVDJ > +dxu0zIZcC8UKS2dI1FB/TVR00l5t4Pr7CVCfSxRqiOfWW7nvQ51ncCQmWbpt > MQq9 > +8d44HbUZoedDU7VFW2q938qMUeHFJLDyZ5OzKo39Ohr/zQXJQoSZMhol0R > qr8LZc > +ppQAJ7Oxiq9HEOr6mWKTKIim3psCAwEAAaNWMFQwDAYDVR0TAQH/BAIw > ADBEBgNV > +HQEEPTA7gBAeQOcW6KCBdWSbrvKQrBrfoRUwEzERMA8GA1UEAxMIVGVz > dFJvb3SC > +ELOMZKZtPz2BS8i5NTXdHNMwCQYFKw4DAh0FAAOCAQEAK7YgK6iiTo07d3C > SY4xG > +9N0QS2m4LsBPrF8pFmk5h6R81MFEdBZrA+zggbUujQ2IGB7k6F7WvP3F3B3 > AXZtx > +DW1FYrQheQhTT5wx85LxFdLy+q6uwUtJi/VyErPmZOcds3QaBXPvG/UykFbu > 24JV > +K2ScLpQVyzmkTN7GWSXrIO6eHHMQgeRX3XjRutbR8CKP1pWTOY+MO4G6Y > ZqrzLdp > +opYFPgvdZpTL3IKSSkp31Amu5oidkvzLgallC3SOYdLZirWEIAAXW2LVYXwiiL6L > +HEIV/G9u85jhKhv/z9l8F/1Eg4HHGSYba8pf1HQA+WsQwi4BVp4x4MBoeHOol > yVT > +/A=3D=3D > +-----END CERTIFICATE----- > diff --git a/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem > b/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem > new file mode 100644 > index 0000000..3ca5149 > --- /dev/null > +++ b/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pem > @@ -0,0 +1,56 @@ > +Bag Attributes > + localKeyID: 01 00 00 00 > + Microsoft CSP Name: Microsoft Strong Cryptographic Provider > + friendlyName: PvkTmp:76c92422-d6f3-4763-9b80-b423fd921d00 > +Key Attributes > + X509v3 Key Usage: 80 > +-----BEGIN PRIVATE KEY----- > +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCU5jNPVsM > HoNCZ > +V8PhVkIBcFkcL0pmjzSek7227JKkkFFdxo+1w4YV32CAvrh4WVub/SeSaczKjj6e > +gUdbhO9cm7NKQ1uNCzEEALaKwKn1IdA/zbBnfVAzLvsbLBYu7lYBh/bI1FMHZ > 5kL > +Rr8dkMbbf21iDEqsqKI8eQ+tj/7B6OUnPfmmmh3sml9iUS6YHSm6a4r7Qw5o > KfW+ > +Z0hEKEX+HTtQcmrAuwyfAmGtY6eH9jKfPhZc7swFvRfoRlKvUIqmfhZpg2lbbk > 3H > +z4C4zfZmP75soOicJmC6qQXdcUq9AKgM91CrRNY+hyE8LeYzJ14hJ7ncOEjW > Opbh > +F0dlZc49AgMBAAECgf8dY26Sej8u15Xiri/l3zXgy7aR7uAAbFGoM8fv2exQgID > k > +FrdxTDtqzqTSxGAkfUWs4Ip2DUEeZDwF/qjW4FCzb3mI/QmNt70Yd9KsEDAm > DkZ2 > +wylcYC2l7IqVEl6HZMpNyiu5hfXdTn/tlkkUIiKr6POYmFR6IyPiS61Tm4LQXyhv > +iW+Lx0GqFQcH82CsbNRNgJGJk/BIiHn7kNDi5rRrKsmTuKEQB9iwF/rKp+lnJN0 > g > +4qTv2bbZVxj39QWdOovU5LCL+1WJdkA2mpFpZjBEsTdF+UEGCbixdiftfovnZa > 64 > +rofw3pIxr97XS42D3OmdPmSokpwqcQtjTXfScCECgYEAvxBMHcEFMZX644hh > ZtH7 > +t0/PCka9DUBZfe58r+lmgSvlbMCka9OvKGtr86+j0IdWqmGWxRHAuk3KR3NI > C3EU > +mD0rYSWiStW0I/cmHidS/a9OdWWHtWi1LcXX7KBn9AjKjPzghqAfDAkRxYfZK > LIo > +PRL44O/RM6nJ1j7az5CgWR0CgYEAx4FW/xVVL1Z0kn/VyNVYLdlhV4zMNn6 > Cu0ko > +jebQydDBh4Tsne2A4dPonZQSsEiJ6jhzaUZr7l5OAEp+0aX0M/h6JbxTcA4CK3X > r > +X2TAaOCkPc1r0I79ZduKymyMNrWfXHenvFVl57klp9eFRQJ6o+pZB9ysFzPHXb > ci > +4VCsX6ECgYBMqAdB8M1apafxXihmDl2FoJmar+LtzCGbqvGPyn772FbGGUxe > jqG5 > +/89iB9gbtBELbvgEvSisFsXPgOso3Ae9RN2Aro68o50QyPocIv7jFVDPPRsDp6z > 5 > +XmVRZNIQUO6jPln+6YNLWuAsdmKkN0Z5qoD8DnvK1JZMRQ+ZM5eB6QKBg > QCuvz+w > +VsMyn4uj9o0PSK/gGRQGV7FX2iAwY7g98vrWix+40FlhS3MkWzTZMaXc+uyy > V5ff > +kmtfcwLnhljm0XHBQ9fZzcdX0y1bXAI6oElYk8vIxnG1UEnsOgyrmcCG+zcHC1f > E > +wxhri+TLyx9UfwNlKBOrq0KhYB00nQDUUpFpgQKBgQCPWpNeNQ8hCARnay > hzu2fE > +HEPG1P/resOp0u+c4jy4TeHVa9806wqZlkYNRKNn09Ub5Ajpp05dwdb+JvUSk > Wwr > +vOmE94WeLg5FuNzPAQjwAe+Eq54Vk8TdAhdLSu1m2xdBKFtEOk6TQTmRBCi > knwhg > +19TgHd8hEFnz6ZICAeWGbQ=3D=3D > +-----END PRIVATE KEY----- > +Bag Attributes > + localKeyID: 01 00 00 00 > +subject=3D/CN=3DTestRoot > +issuer=3D/CN=3DTestRoot > +-----BEGIN CERTIFICATE----- > +MIIC8DCCAdygAwIBAgIQNDAnfwU9lYVDoKT1DJrnyjAJBgUrDgMCHQUAMB > MxETAP > +BgNVBAMTCFRlc3RSb290MB4XDTE2MDgwNDE1MDE0OFoXDTM5MTIzMTI > zNTk1OVow > +EzERMA8GA1UEAxMIVGVzdFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBD > wAwggEK > +AoIBAQCU5jNPVsMHoNCZV8PhVkIBcFkcL0pmjzSek7227JKkkFFdxo+1w4YV3 > 2CA > +vrh4WVub/SeSaczKjj6egUdbhO9cm7NKQ1uNCzEEALaKwKn1IdA/zbBnfVAzLv > sb > +LBYu7lYBh/bI1FMHZ5kLRr8dkMbbf21iDEqsqKI8eQ+tj/7B6OUnPfmmmh3sml > 9i > +US6YHSm6a4r7Qw5oKfW+Z0hEKEX+HTtQcmrAuwyfAmGtY6eH9jKfPhZc7sw > FvRfo > +RlKvUIqmfhZpg2lbbk3Hz4C4zfZmP75soOicJmC6qQXdcUq9AKgM91CrRNY+h > yE8 > +LeYzJ14hJ7ncOEjWOpbhF0dlZc49AgMBAAGjSDBGMEQGA1UdAQQ9MDuAE > M61es/l > +Icdr8+yS1L9lKjWhFTATMREwDwYDVQQDEwhUZXN0Um9vdIIQNDAnfwU9lY > VDoKT1 > +DJrnyjAJBgUrDgMCHQUAA4IBAQBrDeAK0O5bP7ZzSGLo9Fvh7dkAxeUOaPtT > MzBq > +YLruOFtRY3DVfgX+5EUqFWIb/Nh1k1b25gaFIfcIRya5/gVOkCJU9DkJTFyOzX > w7 > +r0stGAb0XCQqZPdZdSiXqZAsukYCamRmSTLLXTT+JOREsMKtFxsFfdNYiC6+Dt > cr > +yly/KCU92Ls8OFLmJ/rSuEVrX39LsCMF6K9n6OJsL5/4c3/DF7yyalsq82vT3H/f > +L9CrBgz+A+eNguyEPch97ctqWzVIVQf7qngaAbuYRYvaiuMhV4YVIxdQG5y8G > lmo > +Kq06fgEkg/ewYea9T9mRkKcquQw7q5UgHPB0zgK6FF3xkSVK > +-----END CERTIFICATE----- > diff --git a/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem > b/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem > new file mode 100644 > index 0000000..14b6418 > --- /dev/null > +++ b/BaseTools/Source/Python/Pkcs7Sign/TestRoot.pub.pem > @@ -0,0 +1,18 @@ > +-----BEGIN CERTIFICATE----- > +MIIC8DCCAdygAwIBAgIQNDAnfwU9lYVDoKT1DJrnyjAJBgUrDgMCHQUAMB > MxETAP > +BgNVBAMTCFRlc3RSb290MB4XDTE2MDgwNDE1MDE0OFoXDTM5MTIzMTI > zNTk1OVow > +EzERMA8GA1UEAxMIVGVzdFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBD > wAwggEK > +AoIBAQCU5jNPVsMHoNCZV8PhVkIBcFkcL0pmjzSek7227JKkkFFdxo+1w4YV3 > 2CA > +vrh4WVub/SeSaczKjj6egUdbhO9cm7NKQ1uNCzEEALaKwKn1IdA/zbBnfVAzLv > sb > +LBYu7lYBh/bI1FMHZ5kLRr8dkMbbf21iDEqsqKI8eQ+tj/7B6OUnPfmmmh3sml > 9i > +US6YHSm6a4r7Qw5oKfW+Z0hEKEX+HTtQcmrAuwyfAmGtY6eH9jKfPhZc7sw > FvRfo > +RlKvUIqmfhZpg2lbbk3Hz4C4zfZmP75soOicJmC6qQXdcUq9AKgM91CrRNY+h > yE8 > +LeYzJ14hJ7ncOEjWOpbhF0dlZc49AgMBAAGjSDBGMEQGA1UdAQQ9MDuAE > M61es/l > +Icdr8+yS1L9lKjWhFTATMREwDwYDVQQDEwhUZXN0Um9vdIIQNDAnfwU9lY > VDoKT1 > +DJrnyjAJBgUrDgMCHQUAA4IBAQBrDeAK0O5bP7ZzSGLo9Fvh7dkAxeUOaPtT > MzBq > +YLruOFtRY3DVfgX+5EUqFWIb/Nh1k1b25gaFIfcIRya5/gVOkCJU9DkJTFyOzX > w7 > +r0stGAb0XCQqZPdZdSiXqZAsukYCamRmSTLLXTT+JOREsMKtFxsFfdNYiC6+Dt > cr > +yly/KCU92Ls8OFLmJ/rSuEVrX39LsCMF6K9n6OJsL5/4c3/DF7yyalsq82vT3H/f > +L9CrBgz+A+eNguyEPch97ctqWzVIVQf7qngaAbuYRYvaiuMhV4YVIxdQG5y8G > lmo > +Kq06fgEkg/ewYea9T9mRkKcquQw7q5UgHPB0zgK6FF3xkSVK > +-----END CERTIFICATE----- > diff --git a/BaseTools/Source/Python/Pkcs7Sign/TestSub.pem > b/BaseTools/Source/Python/Pkcs7Sign/TestSub.pem > new file mode 100644 > index 0000000..67f9d25 > --- /dev/null > +++ b/BaseTools/Source/Python/Pkcs7Sign/TestSub.pem > @@ -0,0 +1,57 @@ > +Bag Attributes > + localKeyID: 01 00 00 00 > + Microsoft CSP Name: Microsoft Strong Cryptographic Provider > + friendlyName: PvkTmp:11e8b08d-46fb-45a2-90c4-d458be4a1276 > +Key Attributes > + X509v3 Key Usage: 80 > +-----BEGIN PRIVATE KEY----- > +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCfNn3oUo5 > iCBXg > +x1AUxgHG/h23/WyThgYj2NAToG3S51i0MGamyjGP8GbBphRc0ORpIhQE8Va > +NPjW > +cdoh4sXLOroW3Es26sR+cxdRwNF0/YxK/+JboYDmdUecgcwqipIv795bVQjRL > CyT > +/+LjLXs/B3XM/jc4jHa7gs+AmwH2DXz9VTsIHmXrm/KGZ64VQzFbJYJl+KvFAml > m > +LcL+t099lyiJYL+3LY2ajonzkAidVQylIfsmhAlcnGee6MYfPxLQRe4pIIlhyXAK > +ZixBnAlZvifo3JRwTKXRHzkj6Vp5KhDsi/31Y54iLJQHiet/FlymIHrtkFpC47xi > +ndF6jNpfAgMBAAECggEAD4owC9xS+A/gosnmxRWhLXJhet3fb8llvAX4zpGau > +Uc > +wVRKu1OCNucOAISx+W/iJhN6GhQRlWByO+wXkGB5UcwaRwpFb8dxBQPo > GMYAgQdm > +XsOkV7E8dZdTirEYjmZsElsP5vY2dW7MWGhiFYO7mHv6ltbmk5G83Qci3biYyR > KB > +4Qb+q/1yl9tdqRvMnLshgSNSa2onGiJ8k9NniSnfnKCc4S0pliy2Z5HOPQCi2QA > k > +eVWORHz5jL8lzlVCflOL7VZiS13YORMDIj0S9LyMhXO4bAtsgWfldqOupNgNW > 0qI > +FwzrNvIXhQxeUiqylzfKNCzuBA11CFBnPt/+agv10QKBgQDH82PHMC3GH8Te > q0lw > +J5G+zYQol1ikRU7O116cAcV04P8HAiAmZ2lrP4DSJWD3y3sOjnnK54KmXkHVc > NJI > +IDjb8d/BZjuYqdylfKhoKNgAdI1WcNKOz7KOK6Le8/ZK1uh1ZHMA6M+L9mTtQ > jhW > +DyoMvEGsQmNHnYF5n3zPQWUMFQKBgQDL17jZMLOORK2U+Iqu0cTVttGU > jg/agP+r > +D4RWwA6BKI0vW3fFOka9MsjBpRZkZdXucq1TusDl8/J30FD/Cjp/gt9RwCQAv > k44 > +Zp6HU3TFEsBdXU+3XeJqTtyJqFuPkRQWrd0UeudSiEJammAlzyF7pPZioF1muc > OA > +nCcDecLFowKBgBv1gKI9rmjh0FmCggZYwhx4CF7UquRtfJOXsfcGmGG7hG2q > cmxs > +UWVZv92itGhx34ctjQI+VRqGW5ZI7F6BgvHeZHdaoEK8ncnWIIZQD8QgiBLq > O8cU > +a9dNarzaSDo2ytJ/dUVPSJY9oec7Nz1xaWPWfyhjMBa3g39KOd2RO1vxAoGB > AMRD > +Q9r6JSeJwId6diy0FAyhJVEfJux+36tYGVddO5nn7Wf3bW4cGhf4WYr45IJt+njH > +OVMwsKG3K3FoxVOKCaDT5SjVEtUUZkOvqlspY3iMAWLjgOlQH7uzimuQCfh > E+06K > +wB4D581zHFAX6xL8R4TA4+k59jP+D9o4fue9yGZ5AoGAMn+TsY1IZFSY1fw6T > THq > +sp9PiYQQqTMjRkzE7GRXbb1rdE6WoLkSk4Dz4u/B9E7YVzTZggYhPisChu6wZP > tK > +IiXBGu8h3GygUGI/WdNRKHW5nst9IZWrtVJ06c87jWqOktbgBnrbqXUG1rgRZ > r+i > +n3sJLF+GGwzdp/gCxLMH66M=3D > +-----END PRIVATE KEY----- > +Bag Attributes > + localKeyID: 01 00 00 00 > +subject=3D/CN=3DTestSub > +issuer=3D/CN=3DTestRoot > +-----BEGIN CERTIFICATE----- > +MIIDADCCAeygAwIBAgIQs4xkpm0/PYFLyLk1Nd0c0zAJBgUrDgMCHQUAMB > MxETAP > +BgNVBAMTCFRlc3RSb290MB4XDTE2MDgwNDE1MDIwOVoXDTM5MTIzMTI > zNTk1OVow > +EjEQMA4GA1UEAxMHVGVzdFN1YjCCASIwDQYJKoZIhvcNAQEBBQADggEPA > DCCAQoC > +ggEBAJ82fehSjmIIFeDHUBTGAcb+Hbf9bJOGBiPY0BOgbdLnWLQwZqbKMY/ > wZsGm > +FFzQ5GkiFATxVr40+NZx2iHixcs6uhbcSzbqxH5zF1HA0XT9jEr/4luhgOZ1R5yB > +zCqKki/v3ltVCNEsLJP/4uMtez8Hdcz+NziMdruCz4CbAfYNfP1VOwgeZeub8oZ > n > +rhVDMVslgmX4q8UCaWYtwv63T32XKIlgv7ctjZqOifOQCJ1VDKUh+yaECVycZ > 57o > +xh8/EtBF7ikgiWHJcApmLEGcCVm+J+jclHBMpdEfOSPpWnkqEOyL/fVjniIslAeJ > +638WXKYgeu2QWkLjvGKd0XqM2l8CAwEAAaNZMFcwDwYDVR0TAQH/BAU > wAwEB/zBE > +BgNVHQEEPTA7gBDOtXrP5SHHa/PsktS/ZSo1oRUwEzERMA8GA1UEAxMIVG > VzdFJv > +b3SCEDQwJ38FPZWFQ6Ck9Qya58owCQYFKw4DAh0FAAOCAQEAFT8uXdMS > HCmatVNg > +LMKsyVA/jJgXGncHmAy59Vjo2+KCIooEuY3NaK527LxB1yi9+UyMe2+Ia4KWc > EGY > ++mb+PDTDrlsYtjIU3aRzDpyXUrkYV/D6vZaw+zsgAquQkCi+WwEYZ4uCSUznlc > yt > +U3p2Rd/+tvQqq5UerPfRBIs6JTUerwRGUQurTNpzqCGClo3zi58yuOEbNIrOz > W1D > +MtQFKUtKkMx4rg6NT9kq/ICXt8k3UIsXh52NTYchkLlsnCgaoKzW2DFqSMFL3 > KC0 > +NmQtmKaPo3mBIYJT0WDofYzas2TQO8cBiQHGrSqXNFAfI5eUo3qLtsRE+7Z9 > F2Mw > +HgNmsA=3D=3D > +-----END CERTIFICATE----- > diff --git a/BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem > b/BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem > new file mode 100644 > index 0000000..a12d837 > --- /dev/null > +++ b/BaseTools/Source/Python/Pkcs7Sign/TestSub.pub.pem > @@ -0,0 +1,19 @@ > +-----BEGIN CERTIFICATE----- > +MIIDADCCAeygAwIBAgIQs4xkpm0/PYFLyLk1Nd0c0zAJBgUrDgMCHQUAMB > MxETAP > +BgNVBAMTCFRlc3RSb290MB4XDTE2MDgwNDE1MDIwOVoXDTM5MTIzMTI > zNTk1OVow > +EjEQMA4GA1UEAxMHVGVzdFN1YjCCASIwDQYJKoZIhvcNAQEBBQADggEPA > DCCAQoC > +ggEBAJ82fehSjmIIFeDHUBTGAcb+Hbf9bJOGBiPY0BOgbdLnWLQwZqbKMY/ > wZsGm > +FFzQ5GkiFATxVr40+NZx2iHixcs6uhbcSzbqxH5zF1HA0XT9jEr/4luhgOZ1R5yB > +zCqKki/v3ltVCNEsLJP/4uMtez8Hdcz+NziMdruCz4CbAfYNfP1VOwgeZeub8oZ > n > +rhVDMVslgmX4q8UCaWYtwv63T32XKIlgv7ctjZqOifOQCJ1VDKUh+yaECVycZ > 57o > +xh8/EtBF7ikgiWHJcApmLEGcCVm+J+jclHBMpdEfOSPpWnkqEOyL/fVjniIslAeJ > +638WXKYgeu2QWkLjvGKd0XqM2l8CAwEAAaNZMFcwDwYDVR0TAQH/BAU > wAwEB/zBE > +BgNVHQEEPTA7gBDOtXrP5SHHa/PsktS/ZSo1oRUwEzERMA8GA1UEAxMIVG > VzdFJv > +b3SCEDQwJ38FPZWFQ6Ck9Qya58owCQYFKw4DAh0FAAOCAQEAFT8uXdMS > HCmatVNg > +LMKsyVA/jJgXGncHmAy59Vjo2+KCIooEuY3NaK527LxB1yi9+UyMe2+Ia4KWc > EGY > ++mb+PDTDrlsYtjIU3aRzDpyXUrkYV/D6vZaw+zsgAquQkCi+WwEYZ4uCSUznlc > yt > +U3p2Rd/+tvQqq5UerPfRBIs6JTUerwRGUQurTNpzqCGClo3zi58yuOEbNIrOz > W1D > +MtQFKUtKkMx4rg6NT9kq/ICXt8k3UIsXh52NTYchkLlsnCgaoKzW2DFqSMFL3 > KC0 > +NmQtmKaPo3mBIYJT0WDofYzas2TQO8cBiQHGrSqXNFAfI5eUo3qLtsRE+7Z9 > F2Mw > +HgNmsA=3D=3D > +-----END CERTIFICATE----- > -- > 2.6.1.windows.1