]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / Rsa2048Sha256Sign / Rsa2048Sha256GenerateKeys.py
index d8048d49a2aeab5b0a9b79424f7509b749e4a9f7..a34dac423b8c1eeb5698917e3e0b9422c12ea9dc 100644 (file)
@@ -1,11 +1,11 @@
 ## @file\r
-# This tool can be used to generate new RSA 2048 bit private/public key pairs \r
-# in a PEM file format using OpenSSL command line utilities that are installed \r
+# This tool can be used to generate new RSA 2048 bit private/public key pairs\r
+# in a PEM file format using OpenSSL command line utilities that are installed\r
 # on the path specified by the system environment variable OPENSSL_PATH.\r
-# This tool can also optionally write one or more SHA 256 hashes of 2048 bit \r
-# public keys to a binary file, write one or more SHA 256 hashes of 2048 bit \r
-# public keys to a file in a C structure format, and in verbose mode display \r
-# one or more SHA 256 hashes of 2048 bit public keys in a C structure format \r
+# This tool can also optionally write one or more SHA 256 hashes of 2048 bit\r
+# public keys to a binary file, write one or more SHA 256 hashes of 2048 bit\r
+# public keys to a file in a C structure format, and in verbose mode display\r
+# one or more SHA 256 hashes of 2048 bit public keys in a C structure format\r
 # on STDOUT.\r
 # This tool has been tested with OpenSSL 1.0.1e 11 Feb 2013\r
 #\r
@@ -26,7 +26,7 @@ from __future__ import print_function
 \r
 import os\r
 import sys\r
-import argparse \r
+import argparse\r
 import subprocess\r
 from Common.BuildVersion import gBUILD_VERSION\r
 \r
@@ -35,14 +35,14 @@ from Common.BuildVersion import gBUILD_VERSION
 #\r
 __prog__      = 'Rsa2048Sha256GenerateKeys'\r
 __version__   = '%s Version %s' % (__prog__, '0.9 ' + gBUILD_VERSION)\r
-__copyright__ = 'Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.'\r
+__copyright__ = 'Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.'\r
 __usage__     = '%s [options]' % (__prog__)\r
 \r
 \r
 if __name__ == '__main__':\r
   #\r
   # Create command line argument parser object\r
-  #  \r
+  #\r
   parser = argparse.ArgumentParser(prog=__prog__, version=__version__, usage=__usage__, description=__copyright__, conflict_handler='resolve')\r
   group = parser.add_mutually_exclusive_group(required=True)\r
   group.add_argument("-o", "--output", dest='OutputFile', type=argparse.FileType('wb'), metavar='filename', nargs='*', help="specify the output private key filename in PEM format")\r
@@ -55,7 +55,7 @@ if __name__ == '__main__':
 \r
   #\r
   # Parse command line arguments\r
-  #  \r
+  #\r
   args = parser.parse_args()\r
 \r
   #\r
@@ -75,18 +75,18 @@ if __name__ == '__main__':
   #\r
   try:\r
     Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
-  except:  \r
+  except:\r
     print('ERROR: Open SSL command not available.  Please verify PATH or set OPENSSL_PATH')\r
     sys.exit(1)\r
-    \r
+\r
   Version = Process.communicate()\r
   if Process.returncode != 0:\r
     print('ERROR: Open SSL command not available.  Please verify PATH or set OPENSSL_PATH')\r
     sys.exit(Process.returncode)\r
   print(Version[0])\r
-  \r
+\r
   args.PemFileName = []\r
-  \r
+\r
   #\r
   # Check for output file argument\r
   #\r
@@ -106,7 +106,7 @@ if __name__ == '__main__':
       if Process.returncode != 0:\r
         print('ERROR: RSA 2048 key generation failed')\r
         sys.exit(Process.returncode)\r
-      \r
+\r
   #\r
   # Check for input file argument\r
   #\r
@@ -158,7 +158,7 @@ if __name__ == '__main__':
   for Item in PublicKeyHash:\r
     PublicKeyHashC = PublicKeyHashC + '0x%02x, ' % (ord(Item))\r
   PublicKeyHashC = PublicKeyHashC[:-2] + '}'\r
-  \r
+\r
   #\r
   # Write SHA 256 of 2048 bit binary public key to public key hash C structure file\r
   #\r
@@ -167,7 +167,7 @@ if __name__ == '__main__':
     args.PublicKeyHashCFile.close ()\r
   except:\r
     pass\r
-    \r
+\r
   #\r
   # If verbose is enabled display the public key in C structure format\r
   #\r