60 * some parameters, and calls {@link JarSigner.Builder#build build} to create 61 * a {@code JarSigner} object. This {@code JarSigner} object can then 62 * be used to sign a jar file. 63 * <p> 64 * Unless otherwise stated, calling a method of {@code JarSigner} or 65 * {@code JarSigner.Builder} with a null argument will throw 66 * a {@link NullPointerException}. 67 * <p> 68 * Example: 69 * <pre> 70 * JarSigner signer = new JarSigner.Builder(key, certPath) 71 * .digestAlgorithm("SHA-1") 72 * .signatureAlgorithm("SHA1withDSA") 73 * .build(); 74 * try (ZipFile in = new ZipFile(inputFile); 75 * FileOutputStream out = new FileOutputStream(outputFile)) { 76 * signer.sign(in, out); 77 * } 78 * </pre> 79 * 80 * @since 1.9 81 */ 82 @jdk.Exported 83 public final class JarSigner { 84 85 /** 86 * A mutable builder class that can create an immutable {@code JarSigner} 87 * from various signing-related parameters. 88 * 89 * @since 1.9 90 */ 91 @jdk.Exported 92 public static class Builder { 93 94 // Signer materials: 95 final PrivateKey privateKey; 96 final X509Certificate[] certChain; 97 98 // JarSigner options: 99 // Support multiple digestalg internally. Can be null, but not empty 100 String[] digestalg; 101 String sigalg; 102 // Precisely should be one provider for each digestalg, maybe later 103 Provider digestProvider; 104 Provider sigProvider; 105 URI tsaUrl; 106 String signerName; 107 BiConsumer<String,String> handler; 108 109 // Implementation-specific properties: | 60 * some parameters, and calls {@link JarSigner.Builder#build build} to create 61 * a {@code JarSigner} object. This {@code JarSigner} object can then 62 * be used to sign a jar file. 63 * <p> 64 * Unless otherwise stated, calling a method of {@code JarSigner} or 65 * {@code JarSigner.Builder} with a null argument will throw 66 * a {@link NullPointerException}. 67 * <p> 68 * Example: 69 * <pre> 70 * JarSigner signer = new JarSigner.Builder(key, certPath) 71 * .digestAlgorithm("SHA-1") 72 * .signatureAlgorithm("SHA1withDSA") 73 * .build(); 74 * try (ZipFile in = new ZipFile(inputFile); 75 * FileOutputStream out = new FileOutputStream(outputFile)) { 76 * signer.sign(in, out); 77 * } 78 * </pre> 79 * 80 * @since 9 81 */ 82 @jdk.Exported 83 public final class JarSigner { 84 85 /** 86 * A mutable builder class that can create an immutable {@code JarSigner} 87 * from various signing-related parameters. 88 * 89 * @since 9 90 */ 91 @jdk.Exported 92 public static class Builder { 93 94 // Signer materials: 95 final PrivateKey privateKey; 96 final X509Certificate[] certChain; 97 98 // JarSigner options: 99 // Support multiple digestalg internally. Can be null, but not empty 100 String[] digestalg; 101 String sigalg; 102 // Precisely should be one provider for each digestalg, maybe later 103 Provider digestProvider; 104 Provider sigProvider; 105 URI tsaUrl; 106 String signerName; 107 BiConsumer<String,String> handler; 108 109 // Implementation-specific properties: |