}
}
private void decode() throws Exception {
try {
final License license;
if ((license = new License())
.loadKeyRing(commandLine.option("keyring-file"), null)
.setLicenseEncodedFromFile(
commandLine.option("license-file")).isVerified()) {
OutputStream os = System.out;
if (commandLine.optionExists("output")) {
os = new FileOutputStream(commandLine.option("output"));
}
Writer w = null;
if (commandLine.optionExists("charset")) {
w = new OutputStreamWriter(os,
commandLine.option("charset"));
} else {
w = new OutputStreamWriter(os);
}
w.write("---LICENSE STRING PLAIN TEXT START\n");
w.flush();
license.dumpLicense(os);
os.flush();
w.write("---LICENSE STRING PLAIN TEXT END\n");
w.write("Encoding license key id=" + license.getDecodeKeyId()
+ "L\n");
w.write("---KEY RING DIGEST START\n");
w.write(license.dumpPublicKeyRingDigest());
w.write("---KEY RING DIGEST END\n");
w.close();
os.close();
} else {
errorOutput.println("The license can not be verified.");