// yes, host-specific
System.out.println("Hostspecific file");
byte[] data =
this.inputStreamToByteArray(archive.getInputStream(entry));
CryptographicProvider p =
CryptographicManager.getInstance().getProvider("OpenPGP");
data = p.decrypt(data, ownerkey);
return data;
} else
{
// we have only the generic information
entry = archive.getEntry(filename + "." + extension);
if (entry == null)
{
System.out.println("File not found: " + filename);
return null;
}
System.out.println("Generic file");
byte[] data =
this.inputStreamToByteArray(archive.getInputStream(entry));
// check signature
CryptographicProvider p =
CryptographicManager.getInstance().getProvider("OpenPGP");
if (ownerkey != null)
{
if (!p.isValidSignature(data, ownerkey))
return null;
data = p.stripSignature(data);
}
return data;
}
}