Package com.verhas.licensor

Examples of com.verhas.licensor.License


  private static PrintStream errorOutput = System.err;

  private void encode() throws Exception {
    try {
      OutputStream os = new FileOutputStream(commandLine.option("output"));
      os.write((new License().setLicense(
          new File(commandLine.option("license-file"))).loadKey(
          commandLine.option("keyring-file"),
          commandLine.option("key")).encodeLicense(commandLine
          .option("password"))).getBytes("utf-8"));
      os.close();
View Full Code Here


    }
  }

  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.");
View Full Code Here

TOP

Related Classes of com.verhas.licensor.License

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.