- java.lang.Object
-  
      - jdk.security.jarsigner.JarSigner.Builder
 
-  
        
       -  
             构造方法摘要构造方法 构造器 描述 Builder(KeyStore.PrivateKeyEntry entry)使用JarSigner.Builder对象创建JarSigner.Builder对象。Builder(PrivateKey privateKey, CertPath certPath)使用私钥和证书路径创建JarSigner.Builder对象。
 -  
             方法摘要所有方法 静态方法 实例方法 具体的方法 变量和类型 方法 描述 JarSignerbuild()根据setter方法设置的参数构建JarSigner对象。JarSigner.BuilderdigestAlgorithm(String algorithm)设置摘要算法。JarSigner.BuilderdigestAlgorithm(String algorithm, Provider provider)设置指定提供程序的摘要算法。JarSigner.BuildereventHandler(BiConsumer<String,String> handler)设置在签名过程中添加,签名或更新JarEntry时将触发的事件处理程序。static StringgetDefaultDigestAlgorithm()获取默认摘要算法。static StringgetDefaultSignatureAlgorithm(PrivateKey key)获取私钥的默认签名算法。JarSigner.BuildersetProperty(String key, String value)设置由指定键指示的其他特定于实现的属性。JarSigner.BuildersignatureAlgorithm(String algorithm)设置签名算法。JarSigner.BuildersignatureAlgorithm(String algorithm, Provider provider)从指定的提供程序设置签名算法。JarSigner.BuildersignerName(String name)设置签名者名称。JarSigner.Buildertsa(URI uri)设置时间戳机构(TSA)的URI。
 
-  
             
-  
        
       -  
             构造方法详细信息-  Builderpublic Builder(KeyStore.PrivateKeyEntry entry) 使用JarSigner.Builder对象创建JarSigner.Builder对象。- 参数
-  
              entry- 签名者的KeyStore.PrivateKeyEntry。
 
 -  Builderpublic Builder(PrivateKey privateKey, CertPath certPath) 使用私钥和证书路径创建JarSigner.Builder对象。- 参数
-  
              privateKey- 签名者的私钥。
-  
              certPath- 签名者的证书路径。
- 异常
-  
              IllegalArgumentException-如果certPath是空的,或者privateKey算法不所述的算法匹配PublicKey终端实体证书中(在第一证书certPath)。
 
 
-  
 -  
             方法详细信息-  digestAlgorithmpublic JarSigner.Builder digestAlgorithm(String algorithm) throws NoSuchAlgorithmException 设置摘要算法。 如果未指定摘要算法,则将使用getDefaultDigestAlgorithm()返回的默认算法。- 参数
-  
              algorithm- 算法的标准名称。 见MessageDigest在部分Java Cryptography Architecture Standard Algorithm Name Documentation有关标准算法名称的信息。
- 结果
-  
              JarSigner.Builder本身。
- 异常
-  
              NoSuchAlgorithmException- 如果algorithm不可用。
 
 -  digestAlgorithmpublic JarSigner.Builder digestAlgorithm(String algorithm, Provider provider) throws NoSuchAlgorithmException 设置指定提供程序的摘要算法。 如果未指定摘要算法,则将使用getDefaultDigestAlgorithm()返回的默认算法。- 参数
-  
              algorithm- 算法的标准名称。 见MessageDigest在部分Java Cryptography Architecture Standard Algorithm Name Documentation有关标准算法名称的信息。
-  
              provider- 提供者。
- 结果
-  
              JarSigner.Builder本身。
- 异常
-  
              NoSuchAlgorithmException- 如果algorithm在指定的提供程序中不可用。
 
 -  signatureAlgorithmpublic JarSigner.Builder signatureAlgorithm(String algorithm) throws NoSuchAlgorithmException 设置签名算法。 如果未指定签名算法, 则将使用getDefaultSignatureAlgorithm(java.security.PrivateKey)为私钥返回的默认签名算法。- 参数
-  
              algorithm- 算法的标准名称。 见Signature在部分Java Cryptography Architecture Standard Algorithm Name Documentation有关标准算法名称的信息。
- 结果
-  
              JarSigner.Builder本身。
- 异常
-  
              NoSuchAlgorithmException- 如果algorithm不可用。
-  
              IllegalArgumentException- 如果algorithm与签名者私钥的算法不兼容。
 
 -  signatureAlgorithmpublic JarSigner.Builder signatureAlgorithm(String algorithm, Provider provider) throws NoSuchAlgorithmException 从指定的提供程序设置签名算法。 如果未指定签名算法, 则将使用getDefaultSignatureAlgorithm(java.security.PrivateKey)为私钥返回的默认签名算法。- 参数
-  
              algorithm- 算法的标准名称。 见Signature在部分Java Cryptography Architecture Standard Algorithm Name Documentation有关标准算法名称的信息。
-  
              provider- 提供者。
- 结果
-  
              JarSigner.Builder本身。
- 异常
-  
              NoSuchAlgorithmException- 如果algorithm在指定的提供程序中不可用。
-  
              IllegalArgumentException- 如果algorithm与签名者私钥的算法不兼容。
 
 -  tsapublic JarSigner.Builder tsa(URI uri) 设置时间戳机构(TSA)的URI。- 参数
-  
              uri- URI。
- 结果
-  
              JarSigner.Builder本身。
 
 -  signerNamepublic JarSigner.Builder signerName(String name) 设置签名者名称。 该名称将用作签名文件的基本名称。 对于签名文件名,所有小写字符都将转换为大写。 如果未指定签名者名称,则将使用字符串“SIGNER”。- 参数
-  
              name- 签名者姓名。
- 结果
-  
              JarSigner.Builder本身。
- 异常
-  
              IllegalArgumentException- 如果name为空或大小超过8,或者包含的字符不是来自“a-zA-Z0-9_-”的字符。
 
 -  eventHandlerpublic JarSigner.Builder eventHandler(BiConsumer<String,String> handler) 设置在签名过程中添加,签名或更新JarEntry时将触发的事件处理程序。处理程序可用于显示签名进度。 处理程序的第一个参数可以是“添加”,“签名”或“更新”,第二个参数是正在处理的 JarEntry的名称。- 参数
-  
              handler- 事件处理程序。
- 结果
-  
              JarSigner.Builder本身。
 
 -  setPropertypublic JarSigner.Builder setProperty(String key, String value) 设置由指定键指示的其他特定于实现的属性。- Implementation Note:
-  
              此实现支持以下属性: 
              -  “tsaDigestAlg”:时间戳请求中的摘要数据算法。 默认值与getDefaultDigestAlgorithm()的结果相同。
- “tsaPolicyId”:用于时间戳授权的TSAPolicyID。 没有默认值。
- “internalsf”:如果.SF文件包含在签名块内,则为“true”,否则为“false”。 默认为“false”。
- “sectionsonly”:如果.SF文件仅包含清单的每个部分的哈希值而不包含整个清单,则为“true”,否则为“false”。 默认为“false”。
 
-  “tsaDigestAlg”:时间戳请求中的摘要数据算法。 默认值与
- 参数
-  
              key- 该物业的名称。
-  
              value- 该属性的值。
- 结果
-  
              JarSigner.Builder本身。
- 异常
-  
              UnsupportedOperationException- 如果此实现不支持该密钥。
-  
              IllegalArgumentException- 如果该值不被接受为此密钥的合法值。
 
 -  getDefaultDigestAlgorithmpublic static String getDefaultDigestAlgorithm() 获取默认摘要算法。- Implementation Note:
- 此实现返回“SHA-256”。 该值可能在将来发生变化。
- 结果
- 默认的摘要算法。
 
 -  getDefaultSignatureAlgorithmpublic static String getDefaultSignatureAlgorithm(PrivateKey key) 获取私钥的默认签名算法。 例如,SHA256withRSA用于2048位RSA密钥,SHA384withECDSA用于384位EC密钥。- Implementation Note:
- 该实现利用了NIST SP 800-57第1部分-Rev.4的表2和3中定义的可比强度。 具体而言,如果密钥大小大于7680位的DSA或RSA密钥,或密钥大小大于或等于512位的EC密钥,则SHA-512将用作签名的哈希函数。 如果DSA或RSA密钥的密钥大小大于3072位,或者EC密钥的密钥大小大于或等于384位,则将使用SHA-384。 否则,将使用SHA-256。 该值可能在将来发生变化。
- 参数
-  
              key- 私钥。
- 结果
-  
              默认签名算法。 
              如果找不到默认签名算法,则返回null。 
              在这种情况下,必须调用signatureAlgorithm(java.lang.String)来指定签名算法。 否则,build()方法将抛出IllegalArgumentException。
 
 -  buildpublic JarSigner build() 根据setter方法设置的参数构建JarSigner对象。此方法不会修改此 Builder对象的内部状态,并且可以多次调用以生成多个JarSigner对象。 调用此方法后,调用此Builder上的任何方法将不会对新构建的JarSigner对象产生任何影响。- 结果
-  
              JarSigner对象。
- 异常
-  
              IllegalArgumentException- 如果未设置签名算法,并且无法使用getDefaultSignatureAlgorithm(java.security.PrivateKey)方法从私钥派生。
 
 
-  
 
-