From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: "Yao, Jiewen" <jiewen.yao@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>,
"Zhu, Yonghong" <yonghong.zhu@intel.com>
Subject: Re: [Patch 1/3] BaseTools: Add the PKCS7 tool
Date: Mon, 15 Aug 2016 08:34:10 +0000 [thread overview]
Message-ID: <B9726D6DCCFB8B4CA276A9169B02216D1136F5FE@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C50028013A9@shsmsx102.ccr.corp.intel.com>
Thanks. I will update it and send a new version.
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Yao, Jiewen
Sent: Monday, August 15, 2016 4:32 PM
To: Zhu, Yonghong <yonghong.zhu@intel.com>; edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
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 <liming.gao@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Subject: [Patch 1/3] BaseTools: Add the PKCS7 tool
>
> Provide the PKCS7 Tool to support the CertType -
> EFI_CERT_TYPE_PKCS7_GUID, then user can use this tool to add
> EFI_FIRMWARE_IMAGE_AUTHENTICATION for a binary.
>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
> ---
> 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
> 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
>
> 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 =
> "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_F ##################
> *_*_*_VPDTOOL_PATH = BPDG
> *_*_*_VPDTOOL_GUID =
> 8C3D856A-9BE6-468E-850A-24F7A8D38E08
>
> ##################
> +# Firmware Image Auth PKCS7 tool definitions ##################
> +*_*_*_PKCS7_PATH = GenFirmwareImageAuthPkcs7
> +*_*_*_PKCS7_GUID =
> 4AAFD29D-68DF-49EE-8AA9-347D375665A7
> +
> +##################
> # NASM tool definitions
> ##################
> *_*_*_NASM_PATH = ENV(NASM_PREFIX)nasm
> # NASMB uses NASM produce a .bin from a .nasmb NASM source file
> *_*_*_NASMB_FLAGS = -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
> reserved.<BR>
> +# Copyright (c) 2010 - 2016, Intel Corporation. All rights
> +reserved.<BR>
> # This program and the accompanying materials # are licensed and
> made available under the terms and conditions of the BSD License #
> which accompanies this distribution. The full text of the license may
> be found at # http://opensource.org/licenses/bsd-license.php
> #
> @@ -29,11 +29,11 @@
> MODULES=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf
> _8,encodings
> BASE_TOOLS_PATH = $(BASE_TOOLS_PATH::\\=:\) EDK_TOOLS_PATH =
> $(EDK_TOOLS_PATH::\\=:\)
>
> BIN_DIR=$(EDK_TOOLS_PATH)\Bin\Win32
>
> -APPLICATIONS=$(BIN_DIR)\build.exe $(BIN_DIR)\GenFds.exe
> $(BIN_DIR)\Trim.exe $(BIN_DIR)\TargetTool.exe $(BIN_DIR)\GenDepex.exe
> $(BIN_DIR)\GenPatchPcdTable.exe $(BIN_DIR)\PatchPcdValue.exe
> $(BIN_DIR)\BPDG.exe $(BIN_DIR)\UPT.exe
> $(BIN_DIR)\Rsa2048Sha256Sign.exe
> $(BIN_DIR)\Rsa2048Sha256GenerateKeys.exe $(BIN_DIR)\Ecc.exe
> +APPLICATIONS=$(BIN_DIR)\build.exe $(BIN_DIR)\GenFds.exe
> $(BIN_DIR)\Trim.exe $(BIN_DIR)\TargetTool.exe $(BIN_DIR)\GenDepex.exe
> $(BIN_DIR)\GenPatchPcdTable.exe $(BIN_DIR)\PatchPcdValue.exe
> $(BIN_DIR)\BPDG.exe $(BIN_DIR)\UPT.exe
> $(BIN_DIR)\Rsa2048Sha256Sign.exe
> $(BIN_DIR)\Rsa2048Sha256GenerateKeys.exe
> $(BIN_DIR)\GenFirmwareImageAuthPkcs7.exe $(BIN_DIR)\Ecc.exe
>
>
> COMMON_PYTHON=$(BASE_TOOLS_PATH)\Source\Python\Common\BuildT
> oolError.py \
>
> $(BASE_TOOLS_PATH)\Source\Python\Common\Database.py \
>
> $(BASE_TOOLS_PATH)\Source\Python\Common\DataType.py \
>
> $(BASE_TOOLS_PATH)\Source\Python\Common\DecClassObject.py \ @@ -283,11
> +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
>
> $(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
> $(BIN_DIR)\TestRoot.pem $(BIN_DIR)\TestRoot.pub.pem
> $(BIN_DIR)\TestSub.pem $(BIN_DIR)\TestSub.pub.pem
> + @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(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
>
> 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.<BR> #
> +This program and the accompanying materials # are licensed and made
> +available under the terms and conditions of the
> BSD License
> +# which accompanies this distribution. The full text of the license
> +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__ = 'GenFirmwareImageAuthPkcs7'
> +__version__ = '%s Version %s' % (__prog__, '0.9 ' + gBUILD_VERSION)
> +__copyright__ = 'Copyright (c) 2016, Intel Corporation. All rights reserved.'
> +__usage__ = '%s -e|-d [options] <input_file>' % (__prog__)
> +
> +#
> +# GUID for PKCS7 from UEFI Specification #
> +WIN_CERT_REVISION = 0x0200
> +WIN_CERT_TYPE_EFI_GUID = 0x0EF1
> +EFI_CERT_TYPE_PKCS7_GUID =
> uuid.UUID('{4aafd29d-68df-49ee-8aa9-347d375665a7}')
> +
> +#
> +# typedef struct _WIN_CERTIFICATE {
> +# UINT32 dwLength;
> +# UINT16 wRevision;
> +# UINT16 wCertificateType;
> +# //UINT8 bCertificate[ANYSIZE_ARRAY]; # } WIN_CERTIFICATE; # #
> +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 =
> collections.namedtuple('EFI_FIRMWARE_IMAGE_AUTHENTICATION',
> ['MonotonicCount','dwLength','wRevision','wCertificateType','CertType'
> ])
> +EFI_FIRMWARE_IMAGE_AUTHENTICATION_STRUCT =
> struct.Struct('QIHH16s')
> +
> +#
> +# Filename of test signing private cert that is stored in same
> +directory as
> this tool
> +#
> +TEST_SIGNER_PRIVATE_CERT_FILENAME = 'TestCert.pem'
> +TEST_OTHER_PUBLIC_CERT_FILENAME = 'TestSub.pub.pem'
> +TEST_TRUSTED_PUBLIC_CERT_FILENAME = 'TestRoot.pub.pem'
> +
> +if __name__ == '__main__':
> + #
> + # Create command line argument parser object
> + #
> + parser = argparse.ArgumentParser(prog=__prog__,
> +version=__version__,
> usage=__usage__, description=__copyright__,
> conflict_handler='resolve')
> + group = parser.add_mutually_exclusive_group(required=True)
> + group.add_argument("-e", action="store_true", dest='Encode',
> help='encode file')
> + group.add_argument("-d", action="store_true", dest='Decode',
> help='decode file')
> + parser.add_argument("-o", "--output", dest='OutputFile', type=str,
> metavar='filename', help="specify the output filename", required=True)
> + parser.add_argument("--signer-private-cert",
> + dest='SignerPrivateCertFile',
> type=argparse.FileType('rb'), help="specify the signer private cert filename.
> If not specified, a test signer private cert is used.")
> + parser.add_argument("--other-public-cert",
> + dest='OtherPublicCertFile',
> type=argparse.FileType('rb'), help="specify the other public cert filename.
> If not specified, a test other public cert is used.")
> + parser.add_argument("--trusted-public-cert",
> + dest='TrustedPublicCertFile',
> type=argparse.FileType('rb'), help="specify the trusted public cert filename.
> If not specified, a test trusted public cert is used.")
> + parser.add_argument("--monotonic-count", dest='MonotonicCountStr',
> type=str, help="specify the MonotonicCount in FMP capsule. If not
> specified, 0 is used.")
> + parser.add_argument("--signature-size", dest='SignatureSizeStr',
> + type=str,
> help="specify the signature size for decode process.")
> + parser.add_argument("-v", "--verbose", dest='Verbose',
> action="store_true", help="increase output messages")
> + parser.add_argument("-q", "--quiet", dest='Quiet',
> + action="store_true",
> help="reduce output messages")
> + parser.add_argument("--debug", dest='Debug', type=int,
> + metavar='[0-9]',
> choices=range(0,10), default=0, help="set debug level")
> + parser.add_argument(metavar="input_file", dest='InputFile',
> type=argparse.FileType('rb'), help="specify the input filename")
> +
> + #
> + # Parse command line arguments
> + #
> + args = parser.parse_args()
> +
> + #
> + # Generate file path to Open SSL command # OpenSslCommand =
> + 'openssl'
> + try:
> + OpenSslPath = os.environ['OPENSSL_PATH']
> + OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
> + except:
> + pass
> +
> + #
> + # Verify that Open SSL command is available #
> + try:
> + Process = subprocess.Popen('%s version' % (OpenSslCommand),
> stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> + except:
> + print 'ERROR: Open SSL command not available. Please verify PATH
> or set OPENSSL_PATH'
> + sys.exit(1)
> +
> + Version = 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 = args.InputFile.name
> + args.InputFileBuffer = args.InputFile.read()
> + args.InputFile.close()
> +
> + #
> + # Save output filename and check if path exists # OutputDir =
> + 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 = args.OutputFile
> +
> + try:
> + if args.MonotonicCountStr.upper().startswith('0X'):
> + args.MonotonicCountValue = (long)(args.MonotonicCountStr, 16)
> + else:
> + args.MonotonicCountValue = (long)(args.MonotonicCountStr)
> + except:
> + args.MonotonicCountValue = (long)(0)
> +
> + if args.Encode:
> + #
> + # Save signer private cert filename and close private cert file
> + #
> + try:
> + args.SignerPrivateCertFileName = args.SignerPrivateCertFile.name
> + args.SignerPrivateCertFile.close()
> + except:
> + try:
> + #
> + # Get path to currently executing script or executable
> + #
> + if hasattr(sys, 'frozen'):
> + Pkcs7ToolPath = sys.executable
> + else:
> + Pkcs7ToolPath = sys.argv[0]
> + if Pkcs7ToolPath.startswith('"'):
> + Pkcs7ToolPath = Pkcs7ToolPath[1:]
> + if Pkcs7ToolPath.endswith('"'):
> + Pkcs7ToolPath = RsaToolPath[:-1]
> + args.SignerPrivateCertFileName =
> os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)),
> TEST_SIGNER_PRIVATE_CERT_FILENAME)
> + args.SignerPrivateCertFile =
> + 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 = args.OtherPublicCertFile.name
> + args.OtherPublicCertFile.close()
> + except:
> + try:
> + #
> + # Get path to currently executing script or executable
> + #
> + if hasattr(sys, 'frozen'):
> + Pkcs7ToolPath = sys.executable
> + else:
> + Pkcs7ToolPath = sys.argv[0]
> + if Pkcs7ToolPath.startswith('"'):
> + Pkcs7ToolPath = Pkcs7ToolPath[1:]
> + if Pkcs7ToolPath.endswith('"'):
> + Pkcs7ToolPath = RsaToolPath[:-1]
> + args.OtherPublicCertFileName =
> os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)),
> TEST_OTHER_PUBLIC_CERT_FILENAME)
> + args.OtherPublicCertFile = open(args.OtherPublicCertFileName,
> 'rb')
> + args.OtherPublicCertFile.close()
> + except:
> + print 'ERROR: test other public cert file %s missing' %
> (args.OtherPublicCertFileName)
> + sys.exit(1)
> +
> + format = "Q%ds" % len(args.InputFileBuffer)
> + FullInputFileBuffer =
> + struct.pack(format,args.MonotonicCountValue,
> args.InputFileBuffer)
> +
> + #
> + # Sign the input file using the specified private key and capture
> signature from STDOUT
> + #
> + Process = subprocess.Popen('%s smime -sign -binary -signer "%s"
> -outform DER -md sha256 -certfile "%s"' % (OpenSslCommand,
> args.SignerPrivateCertFileName, args.OtherPublicCertFileName),
> stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> + Signature = Process.communicate(input=FullInputFileBuffer)[0]
> + if Process.returncode <> 0:
> + sys.exit(Process.returncode)
> +
> + #
> + # Write output file that contains Signature, and Input data
> + #
> + args.OutputFile = 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 = args.TrustedPublicCertFile.name
> + args.TrustedPublicCertFile.close()
> + except:
> + try:
> + #
> + # Get path to currently executing script or executable
> + #
> + if hasattr(sys, 'frozen'):
> + Pkcs7ToolPath = sys.executable
> + else:
> + Pkcs7ToolPath = sys.argv[0]
> + if Pkcs7ToolPath.startswith('"'):
> + Pkcs7ToolPath = Pkcs7ToolPath[1:]
> + if Pkcs7ToolPath.endswith('"'):
> + Pkcs7ToolPath = RsaToolPath[:-1]
> + args.TrustedPublicCertFileName =
> os.path.join(os.path.dirname(os.path.realpath(Pkcs7ToolPath)),
> TEST_TRUSTED_PUBLIC_CERT_FILENAME)
> + args.TrustedPublicCertFile =
> + 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
> + the
> size of the signature data!"
> + sys.exit(1)
> + else:
> + if args.SignatureSizeStr.upper().startswith('0X'):
> + SignatureSize = (long)(args.SignatureSizeStr, 16)
> + else:
> + SignatureSize = (long)(args.SignatureSizeStr)
> + if SignatureSize < 0:
> + print "ERROR: The value of option --signature-size can't be
> + set to
> negative value!"
> + sys.exit(1)
> + elif SignatureSize > len(args.InputFileBuffer):
> + print "ERROR: The value of option --signature-size is exceed
> + the
> size of the input file !"
> + sys.exit(1)
> +
> + args.SignatureBuffer = args.InputFileBuffer[0:SignatureSize]
> + args.InputFileBuffer = args.InputFileBuffer[SignatureSize:]
> +
> + format = "Q%ds" % len(args.InputFileBuffer)
> + FullInputFileBuffer =
> + struct.pack(format,args.MonotonicCountValue,
> args.InputFileBuffer)
> +
> + #
> + # Save output file contents from input file
> + #
> + open(args.OutputFileName, 'wb').write(FullInputFileBuffer)
> +
> + #
> + # Verify signature
> + #
> + Process = subprocess.Popen('%s smime -verify -inform DER
> -content %s -CAfile %s' % (OpenSslCommand, args.OutputFileName,
> args.TrustedPublicCertFileName), stdin=subprocess.PIPE,
> stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> + Process.communicate(input=args.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+gCNgm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CHQzJ/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=/CN=TestCert
> +issuer=/CN=TestSub
> +-----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==
> +-----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==
> +-----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==
> +-----END PRIVATE KEY-----
> +Bag Attributes
> + localKeyID: 01 00 00 00
> +subject=/CN=TestRoot
> +issuer=/CN=TestRoot
> +-----BEGIN CERTIFICATE-----
> +MIIC8DCCAdygAwIBAgIQNDAnfwU9lYVDoKT1DJrnyjAJBgUrDgM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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+wXkGB5UcwaRwpFb8dxB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1rdE6WoLkSk4Dz4u/B9E7YVzTZggYhPisChu6wZP
> tK
> +IiXBGu8h3GygUGI/WdNRKHW5nst9IZWrtVJ06c87jWqOktbgBnrbqXUG1rgRZ
> r+i
> +n3sJLF+GGwzdp/gCxLMH66M=
> +-----END PRIVATE KEY-----
> +Bag Attributes
> + localKeyID: 01 00 00 00
> +subject=/CN=TestSub
> +issuer=/CN=TestRoot
> +-----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==
> +-----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==
> +-----END CERTIFICATE-----
> --
> 2.6.1.windows.1
next prev parent reply other threads:[~2016-08-15 8:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-15 8:17 [Patch 0/3] BaseTools: Add the support for FMP capsule generate auth info Yonghong Zhu
2016-08-15 8:17 ` [Patch 1/3] BaseTools: Add the PKCS7 tool Yonghong Zhu
2016-08-15 8:32 ` Yao, Jiewen
2016-08-15 8:34 ` Zhu, Yonghong [this message]
2016-08-15 8:17 ` [Patch 2/3] BaseTools: Rsa2048Sha256Sign add new option to support Monotonic count Yonghong Zhu
2016-08-19 5:41 ` Gao, Liming
2016-08-15 8:17 ` [Patch 3/3] BaseTools: FMP capsule add the support to generate auth info Yonghong Zhu
2016-08-19 5:41 ` Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B9726D6DCCFB8B4CA276A9169B02216D1136F5FE@SHSMSX103.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox