8000 Signable.of keeps handles to file open after auto closing. · Issue #294 · ebourg/jsign · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Signable.of keeps handles to file open after auto closing. #294
Open
@cg110

Description

@cg110

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0