Skip to content

Commit

Permalink
Merge pull request #23425 from hussainnm/fix-jar-signer
Browse files Browse the repository at this point in the history
Failed to create signed jar for appclient
  • Loading branch information
smillidge authored Mar 17, 2021
2 parents 83e8450 + 1c99bfe commit fd979a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -72,8 +72,8 @@ public class ASJarSigner implements PostConstruct {
/** default alias for signing if the admin does not specify one */
private static final String DEFAULT_ALIAS_VALUE = "s1as";

private static final String DEFAULT_DIGEST_ALGORITHM = "SHA1";
private static final String DEFAULT_KEY_ALGORITHM = "RSA";
private static final String DEFAULT_DIGEST_ALGORITHM = "SHA-1";
private static final String DEFAULT_SIGNATURE_ALGORITHM = "SHA1withRSA";

private static final SecuritySupport securitySupport = SecuritySupport.getDefaultInstance();

Expand Down Expand Up @@ -154,7 +154,7 @@ public long signJar(final File unsignedJar, final ZipOutputStream signedJar,

JarSigner signer = new JarSigner.Builder(privateKey, certPath)
.digestAlgorithm(DEFAULT_DIGEST_ALGORITHM)
.signatureAlgorithm(DEFAULT_KEY_ALGORITHM)
.signatureAlgorithm(DEFAULT_SIGNATURE_ALGORITHM)
.build();

// TODO: add Attributes to Manifest and additionalContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,8 @@ grant codeBase "jrt:/jdk.compiler" {
permission java.lang.RuntimePermission "getenv.JDK_JAVAC_OPTIONS";
permission java.lang.RuntimePermission "createClassLoader";
};

// Following grant block is required for using JDK JarSigner
grant {
permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc";
};

0 comments on commit fd979a0

Please sign in to comment.