Open
Description
Hi,
I'm using jsign-core 7.1, and wanted to test if a set of dlls are signed, so I loop over a list of files, and check if they have signatures, below is a very cut down version, but shows the problem. When it's waiting for a read th 66E2 e file is still locked. If I directly use PEFile it works fine. Suggesting one of the auto-detections isn't closing the file after probing it. Sadly I'm more a c# developer so not quite sure how to go about debugging the problem (and for now use pefile works, if I check the file ends with .dll or .exe)
import net.jsign.Signable;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class Main {
public static void main(String[] args) {
for (String path: args)
{
try (Signable signable = Signable.of(new File(path))) {
List<org.bouncycastle.cms.CMSSignedData> signatures = signable.getSignatures();
System.out.println("Found signatures " + signatures.size());
} catch (Exception e) {
System.out.println(e.toString());
}
}
try {
// wait for the user to hit any key
// checking the file passed in it's locked.
System.in.read();
} catch (IOException e) {
System.out.println(e.toString());
}
}
}
Thanks