class CryptoContainer {

    @WorkerThread
    public static CryptoContainer open(File file) throws CryptoException {
        try (
                InputStream dataFilesStream = new FileInputStream(file);
                InputStream recipientsStream = new FileInputStream(file)
        ) {
            ImmutableList.Builder<File> dataFilesBuilder = ImmutableList.builder();
            ImmutableList.Builder<Certificate> recipientsBuilder = ImmutableList.builder();

            for (String dataFileName : CDOCParser.getDataFileNames(dataFilesStream)) {
                dataFilesBuilder.add(new File(dataFileName));
            }

            for (Recipient recipient : CDOCParser.getRecipients(recipientsStream)) {
                recipientsBuilder.add(Certificate
                        .create(ByteString.of(recipient.getCertificate().getEncoded())));
            }

            return create(file, dataFilesBuilder.build(), recipientsBuilder.build(), false);
        } catch (Exception e) {
            throw new CryptoException("Can't open crypto container", e);
        }
    }

}