in codesign/src/main/java/org/apache/tomcat/buildutil/SignCodeMojo.java [168:220]
public void execute() throws MojoExecutionException {
List<File> filesToSign = new ArrayList<>();
if ( includeProjectArtifact )
filesToSign.add(project.getArtifact().getFile());
if ( artifactSets != null ) {
for ( FileSet artifactSet : artifactSets ) {
File base = new File(project.getBasedir(), artifactSet.getDirectory());
Scanner scanner = buildContext.newScanner(base);
scanner.setIncludes(artifactSet.getIncludes().toArray(new String[0]));
scanner.setExcludes(artifactSet.getExcludes().toArray(new String[0]));
scanner.scan();
for ( String file : scanner.getIncludedFiles() ) {
filesToSign.add(new File(base, file));
}
}
}
if ( filesToSign.isEmpty() ) {
getLog().info("No files to sign, skipping");
return;
}
for ( File toSign : filesToSign )
getLog().info("Would sign " + toSign);
// Set up the TLS client
System.setProperty("javax.net.ssl.keyStore", keyStore);
System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
String oldSslDebug = null;
if ( sslDebug ) {
oldSslDebug = System.setProperty("javax.net.debug","all");
}
SignedFiles signedFiles = new SignedFiles(filesToSign);
try {
String signingSetID = makeSigningRequest(signedFiles);
downloadSignedFiles(signedFiles, signingSetID);
} catch (SOAPException | IOException e) {
throw new MojoExecutionException("Signing failed : " + e.getMessage(), e);
} finally {
if ( sslDebug ) {
if ( oldSslDebug != null ) {
System.setProperty("javax.net.debug", oldSslDebug);
} else {
System.clearProperty("javax.net.debug");
}
}
}
}