jdk/test/sun/security/tools/jarsigner/compatibility/README
changeset 46156 79e8a865c5b8
equal deleted inserted replaced
46155:a6288a07bb53 46156:79e8a865c5b8
       
     1 # Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
       
     2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     3 #
       
     4 # This code is free software; you can redistribute it and/or modify it
       
     5 # under the terms of the GNU General Public License version 2 only, as
       
     6 # published by the Free Software Foundation.
       
     7 #
       
     8 # This code is distributed in the hope that it will be useful, but WITHOUT
       
     9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    10 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    11 # version 2 for more details (a copy is included in the LICENSE file that
       
    12 # accompanied this code).
       
    13 #
       
    14 # You should have received a copy of the GNU General Public License version
       
    15 # 2 along with this work; if not, write to the Free Software Foundation,
       
    16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    17 #
       
    18 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    19 # or visit www.oracle.com if you need additional information or have any
       
    20 # questions.
       
    21 
       
    22 ##### Summary #####
       
    23 This test is used to verify the compatibility on jarsigner cross different JDK
       
    24 releases. It also can be used to check jar signing (w/ and w/o TSA) and verifying
       
    25 on some specific key algorithms and digest algorithms.
       
    26 
       
    27 ##### Output #####
       
    28 The test will generate a report, at JTwork/scratch/report.html, to display the
       
    29 key parameters for signing and the status of signing and verifying. And it will
       
    30 generate another report, at JTwork/scratch/failedReport.html, to collect all of
       
    31 failed cases.
       
    32 
       
    33 Please note that, the test may output a great deal of logs if the jdk list and
       
    34 TSA list are big, and that would lead to jtreg output overflow. So, it redirects
       
    35 stdout and stderr to file JTwork/scratch/details.out.
       
    36 
       
    37 ##### Report Columns #####
       
    38 Certificate
       
    39     Certificate identifier. The identifier consists of specific attributes of
       
    40     the certificate. Generally, the naming convention is:
       
    41     KeyAlgorithm_DigestAlgorithm_[KeySize][_Expired]
       
    42 
       
    43 Signer JDK
       
    44     The JDK version that signs jar.
       
    45 
       
    46 Signature Algorithm
       
    47     The signature algorithm used by signing.
       
    48 
       
    49 TSA Digest
       
    50     The timestamp digest algorithm used by signing.
       
    51 
       
    52 TSA
       
    53     TSA URL index. All of TSA URLs and their indices can be found at the top
       
    54     of this report.
       
    55 
       
    56 Signing Status
       
    57     Signing process result status. The status are the followings:
       
    58     [1]NONE, no action.
       
    59     [2]NORMAL, no any error and warning.
       
    60     [3]WARNING, no any error but some warnings raise.
       
    61     [4]ERROR, some errors raise.
       
    62 
       
    63 Verifier JDK
       
    64     The JDK version that verifies signed jars.
       
    65 
       
    66 Verifying Status
       
    67     Verifying process result status. The status are the same as those for
       
    68     "Status of Signing".
       
    69 
       
    70 Delay Verifying Status
       
    71     Delay verifying process result status. The status are the same as those
       
    72     for "Status of Signing".
       
    73 
       
    74 Failed
       
    75     It highlights which case fails. The failed cases (rows) are marked with
       
    76     letter X.
       
    77 
       
    78 ##### Usages #####
       
    79 jtreg [-options] \
       
    80     -jdk:<path/to/testing/JDK>
       
    81     [-DproxyHost=<host> \
       
    82      -DproxyPort=<port> \
       
    83      -DtsaListFile=</url/to/tsaListFile> \
       
    84      -DtsaList=</path/to/tsa1#/path/to/tsa2#/path/to/tsa3#...> \
       
    85      -DjdkListFile=</path/to/jdkListFile> \
       
    86      -DjdkList=</path/to/jdk1#/path/to/jdk2#/path/to/jdk3#...> \
       
    87      -DjavaSecurityFile=</path/to/java/security/properties/file> \
       
    88      -DdelayVerify=<true|false> \
       
    89      -DcertValidity=<[1, 1440]>] \
       
    90     <JDK_REPO>/jdk/test/sun/security/tools/jarsigner/compatibility/Compatibility.java
       
    91 
       
    92 Besides the common jtreg options, like -jdk, this test introduces a set of
       
    93 properties for receiving users' inputs and making the test more flexible. These
       
    94 properties are:
       
    95 proxyHost=<host>
       
    96     This property indicates proxy host.
       
    97 
       
    98 proxyPort=<port>
       
    99     This property indicates proxy port. The default value is 80.
       
   100 
       
   101 tsaListFile=</path/to/tsaListFile>
       
   102     This property indicates a local file, which contains a set of TSA URLs and
       
   103     the supported digest algorithms (by optional parameter digests). The format
       
   104     of the file content looks like the below,
       
   105     http://path/to/tsa1
       
   106     http://path/to/tsa2;digests=SHA-1,SHA-256
       
   107     https://path/to/tsa3
       
   108     ...
       
   109 
       
   110     If a TSA line does not list the supported digest algorithms, that means
       
   111     the TSA supports SHA-1, SHA-256 and SHA-512. Because the test only focus
       
   112     on SHA-1, SHA-256 and SHA-512. So, if other digest algorithms, like SHA-224
       
   113     and SHA-384, are listed, they just be ignored.
       
   114 
       
   115 tsaList=</path/to/tsa1#/path/to/tsa2;digests=SHA-1,SHA-256#...>
       
   116     This property directly lists a set of TSAs in command. "#" is the delimiter.
       
   117     Note that, if both of tsaListFile and tsaList are specified, only property
       
   118     jdkListFile is selected. If neither of tsaListFile and tsaList is specified,
       
   119     the test will fails immediately.
       
   120 
       
   121 jdkListFile=</path/to/jdkListFile>
       
   122     This property indicates a local file, which contains a set of local JDK
       
   123     paths. The style of the file content looks like the below,
       
   124     /path/to/jdk1
       
   125     /path/to/jdk2
       
   126     /path/to/jdk3
       
   127     ...
       
   128 
       
   129 jdkList=</path/to/jdk1#/path/to/jdk2#/path/to/jdk3#...>
       
   130     This property directly lists a set of local JDK paths in command. "#" is
       
   131     the delimiter.
       
   132     Note that, if both of jdkListFile and jdkList are specified, only property
       
   133     jdkListFile is selected. If neither of jdkListFile nor jdkList is specified,
       
   134     the testing JDK, which is specified by jtreg option -jdk will be used as
       
   135     the only one JDK in the JDK list.
       
   136 
       
   137 javaSecurityFile=</path/to/java/security/properties/file>
       
   138     This property indicates an alternative java security properties file. The
       
   139     default file is the path of file java.scurity that is distributed with
       
   140     this test.
       
   141 
       
   142 delayVerify=<true|false>
       
   143     This property indicates if doing an additional verifying after all of valid
       
   144     certificates expire. The default value is false.
       
   145 
       
   146 certValidity=<[1, 1440]>
       
   147     This property indicates the remaining validity period in minutes for valid
       
   148     certificates. The value range is [1, 1440]. The default value is 1440.
       
   149     Note that, if delayVerify is false, this property doesn't take effect.
       
   150 
       
   151 The testing JDK, which is specified by jtreg option "-jdk", should include the
       
   152 fix for JDK-8163304. Otherwise, the signature algorithm and timestamp digest
       
   153 algorithm cannot be extracted from verification output. And this JDK should
       
   154 support as many as possible signature algorithms. Anyway the latest JDK build
       
   155 is always recommended.
       
   156 
       
   157 ##### Examples #####
       
   158 $ cat /path/to/jdkList
       
   159 /path/to/jdk6u171-b05
       
   160 /path/to/jdk7u161-b05
       
   161 /path/to/jdk8u144-b01
       
   162 /path/to/jdk9-179 
       
   163 
       
   164 $ cat /path/to/tsaList
       
   165 http://timestamp.comodoca.com/rfc3161
       
   166 http://sha256timestamp.ws.symantec.com/sha256/timestamp
       
   167 http://tsa.starfieldtech.com
       
   168 http://timestamp.entrust.net/TSS/RFC3161sha1TS;digests=SHA-1,SHA-256
       
   169 http://timestamp.entrust.net/TSS/RFC3161sha2TS;digests=SHA-1,SHA-256
       
   170 http://rfc3161timestamp.globalsign.com/advanced;digests=SHA-256,SHA-512
       
   171 http://rfc3161timestamp.globalsign.com/standard
       
   172 http://timestamp.globalsign.com/scripts/timstamp.dll
       
   173 http://timestamp.globalsign.com/?signature=sha2;digests=SHA-256,SHA-512
       
   174 http://timestamp.digicert.com
       
   175 http://time.certum.pl
       
   176 http://tsa.swisssign.net
       
   177 http://zeitstempel.dfn.de
       
   178 https://tsp.iaik.tugraz.at/tsp/TspRequest
       
   179 
       
   180 $ jtreg -va -nr -timeout:100 \
       
   181     -jdk:/path/to/latest/jdk \
       
   182     -DproxyHost=<proxy> -DproxyPort=<port> \
       
   183     -DjdkListFile=/path/to/jdkList \
       
   184     -DtsaListFile=/path/to/tsaList \
       
   185     -DdelayVerify=true -DcertValidity=60 \
       
   186     <JDK_REPO>/jdk/test/sun/security/tools/jarsigner/compatibility/Compatibility.java
       
   187 
       
   188 The above is a comprehensive usage example. File "jdkList" lists the paths of
       
   189 testing JDK builds, and file "tsaList" lists the URLs of TSA services. Some TSAs,
       
   190 like http://timestamp.entrust.net/TSS/RFC3161sha1TS, specify the supported digest
       
   191 algorithms. Other TSAs, which don't specify parameter digests, are regarded to
       
   192 support SHA-1, SHA-256 and SHA-512. The test uses a proxy to access TSA services.
       
   193 And it enables delay verifying and set the certificate validity period to 60
       
   194 minutes. So, after the first verification is done, the test will wait for all
       
   195 of valid certificates expire and then does verification again.
       
   196 
       
   197 If don't want to provide such JDK list and TSA list files, the test allows to
       
   198 specify JDKs and TSAs (via properties jdkList and tsaList respectively) in the
       
   199 command directly, like the below style,
       
   200 $ jtreg -va -nr -timeout:100 \
       
   201     -jdk:/path/to/latest/jdk \
       
   202     -DproxyHost=<proxy> -DproxyPort=<port> \
       
   203     -DjdkList=/path/to/jdk6u171-b05#/path/to/jdk7u161-b05#/path/to/jdk8u144-b01#/path/to/jdk9-179 \
       
   204     -DtsaList=http://timestamp.comodoca.com/rfc3161#http://timestamp.entrust.net/TSS/RFC3161sha1TS;digests=SHA-1,SHA-256 \
       
   205     -DdelayVerify=true -DcertValidity=60 \
       
   206     <JDK_REPO>/jdk/test/sun/security/tools/jarsigner/compatibility/Compatibility.java
       
   207 
       
   208 Furthermore, here introduces one of the simplest usages. It doesn't specify any
       
   209 JDK list, so the testing JDK, which is specified by jtreg option "-jdk", will
       
   210 be tested. And it doesn't apply delay verifying, and no proxy is used, and use
       
   211 only one TSA. Now, the command is pretty simple and looks like the followings,
       
   212 $ jtreg -va -nr -timeout:100 \
       
   213     -jdk:/path/to/latest/jdk \
       
   214     -DtsaList=http://timestamp.comodoca.com/rfc3161 \
       
   215     <JDK_REPO>/jdk/test/sun/security/tools/jarsigner/compatibility/Compatibility.java