protected void _showDialog_() {
    String strMethod = "_showDialog_()";

    String[] strsTypeFileShkCur = _getTypeFileShkCur();

    if (strsTypeFileShkCur == null)
      MySystem.s_printOutExit(this, strMethod, "nil strsTypeFileShkCur");

    String strFileDesc = _getDescFileShkCur();

    if (strFileDesc == null) MySystem.s_printOutExit(this, strMethod, "nil strFileDesc");

    // ----

    File fle = null;

    String strButtonTextOk = "Save file";

    fle =
        S_FileChooserUI.s_getSaveFile(
            super._frmParent_,
            strButtonTextOk,
            strsTypeFileShkCur,
            strFileDesc,
            com.google.code.p.keytooliui.ktl.io.S_FileExtensionUI.f_s_strDirNameDefaultShk);

    if (fle == null) {
      // cancelled
      return;
    }

    if (!_assignValues(fle))
      MySystem.s_printOutExit(this, strMethod, "failed, fle.getName()=" + fle.getName());
  }
Exemplo n.º 2
0
  /* transform manifest in an array of byte
      if any code error, exit
      else if any error, show dialog, then return nil
  */
  public static byte[] s_toByteArray(Manifest man, Frame frmOwner) {
    String strMethod = _f_s_strClass + "s_toByteArray(...)";

    if (man == null) {
      MySystem.s_printOutExit(strMethod, "nil man");
    }

    ByteArrayOutputStream baoBuffer = new ByteArrayOutputStream();

    try {
      man.write(baoBuffer);
      baoBuffer.flush();
      baoBuffer.close();
    } catch (IOException excIO) {
      excIO.printStackTrace();
      MySystem.s_printOutExit(strMethod, "excIO caught");

      String strBody = "Got IO exception";

      OPAbstract.s_showDialogError(frmOwner, strBody);

      return null;
    }

    return baoBuffer.toByteArray();
  }
  /** should be X509Cert, either RSA or DSA */
  private Boolean[] _getBoosElligibleSource(
      String[] strsAlgoKeyPublSource, Boolean[] boosTypeCertX509Source) {
    String strMethod = "_getBoosElligibleSource(...)";

    if (strsAlgoKeyPublSource == null || boosTypeCertX509Source == null)
      MySystem.s_printOutExit(this, strMethod, "nil arg");

    Boolean[] boosElligibleSource = new Boolean[strsAlgoKeyPublSource.length];

    for (int i = 0; i < strsAlgoKeyPublSource.length; i++) {
      boolean blnOk = true;

      String str = strsAlgoKeyPublSource[i].toLowerCase();

      // should be of type DSA OR RSA
      if ((str.compareTo(KTLAbs.f_s_strTypeKeypairDsa.toLowerCase()) != 0)
          && (str.compareTo(KTLAbs.f_s_strTypeKeypairRsa.toLowerCase()) != 0)) {
        blnOk = false;
      }

      // certificate should be of type X509
      else if (boosTypeCertX509Source[i].booleanValue() == false) {
        blnOk = false;
      }

      // --

      boosElligibleSource[i] = new Boolean(blnOk);
    }

    // ----
    return boosElligibleSource;
  }
Exemplo n.º 4
0
  protected TBMainAbstract(
      String strHelpID,
      ActionListener actListenerParent,
      // javax.help.HelpBroker hbrHelpStandard,
      int intOrientation,
      javax.swing.ImageIcon
          iinFrameFloatable, // should be used once bug fixed "setFloatable(true), see below
      boolean blnDoHelpOnItem,
      boolean blnFloatable) {
    super(intOrientation, iinFrameFloatable, strHelpID, blnFloatable);

    String strMethod = "TBMainAbstract(...)";

    try {
      this._btnHelpSource_ = new BESHelpJHSource();

      if (blnDoHelpOnItem) {
        this._btnHelpTrack_ = new BESHelpJHTrack();
      }
    } catch (NullPointerException excNullPointer) {
      excNullPointer.printStackTrace();
      MySystem.s_printOutExit(this, strMethod, "excNullPointerCaught");
    }

    this._btnExit_ = new BESExit24(actListenerParent);

    if (actListenerParent != null) super._btnPrint_ = new BESPrint24(actListenerParent);
  }
Exemplo n.º 5
0
  public boolean isDefault() {
    String strMethod = "isDefault()";

    if (getText() == null) MySystem.s_printOutExit(this, strMethod, "getText() == null");

    if (getText().compareTo(Tfd10x30SelString._f_s_strDefault) == 0) return true;

    return false;
  }
Exemplo n.º 6
0
  public static boolean s_isWindows() {
    String strMethod = _f_s_strClass + "s_isWindows()";

    if (_s_strOsName == null) _s_strOsName = System.getProperty("os.name");

    if (_s_strOsName == null) MySystem.s_printOutExit(strMethod, "nil _s_strOsName");

    if (_s_strOsName.toLowerCase().startsWith(_f_s_strOsWindows)) return true;

    return false;
  }
  /**
   * if any code error, exit else if any other error, show warning-error dialog, then return false
   * else return true
   */
  public boolean doJob() {
    String strMethod = "doJob()";

    // x) if pathAbsKeystore != nil, load keystore of type "JKS"
    java.security.KeyStore kstOpen = null;

    if (super._strPathAbsKst_ != null) {
      if (super._strProviderKst_ == null) {
        MySystem.s_printOutExit(this, strMethod, "nil super._strProviderKst_");
      }

      // if
      // (super._strProviderKst_.toLowerCase().compareTo(KTLAbs._f_s_strSecurityProviderSun_.toLowerCase()) != 0)
      //  MySystem.s_printOutExit(this, strMethod, "wrong value, super._strProviderKst_=" +
      // super._strProviderKst_);
      // MySystem.s_printOutWarning(this, strMethod, "should check for keystore of type JKS,
      // provider named SUN");

      // memo: keystore should be of type "JKS", provided by "SUN"
      File fleOpen = UtilJsrFile.s_getFileOpen(super._frmOwner_, super._strPathAbsKst_);

      if (fleOpen == null) {
        MySystem.s_printOutError(this, strMethod, "nil fleOpen");
        return false;
      }

      kstOpen =
          UtilKstJks.s_getKeystoreOpen(
              super._frmOwner_,
              fleOpen,
              (char[]) null // keystore's Password, not in use for verifying signed jarred file
              );

      if (kstOpen == null) {
        MySystem.s_printOutError(this, strMethod, "nil kstOpen");
        return false;
      }
    }

    super._setEnabledCursorWait_(true);

    if (!super._doJob_(kstOpen)) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    super._setEnabledCursorWait_(false);

    // ----
    return true;
  }
  static {
    final String f_strWhere =
        "com.google.code.p.keytooliui.shared.swing.menu.METextAlignmentEditorText";

    try {
      _s_rbeResources =
          java.util.ResourceBundle.getBundle(
              _f_s_strBundleFileShort, java.util.Locale.getDefault());
    } catch (java.util.MissingResourceException excMissingResource) {
      excMissingResource.printStackTrace();
      MySystem.s_printOutExit(f_strWhere, _f_s_strBundleFileLong + "excMissingResource caught");
    }
  }
Exemplo n.º 9
0
  public static boolean s_isWinPub() {
    String strMethod = _f_s_strClass + "s_isWinPub()";

    if (!s_isWindows()) return false;

    if (_s_strOsName == null) MySystem.s_printOutExit(strMethod, "nil _s_strOsName");

    if (_s_strOsName.toLowerCase().endsWith("95")
        || _s_strOsName.toLowerCase().endsWith("98")
        || _s_strOsName.toLowerCase().endsWith("me")) return true;

    return false;
  }
Exemplo n.º 10
0
  public static boolean s_isUSun() {
    String strMethod = _f_s_strClass + "s_isUSun()";

    if (_s_strOsName == null) _s_strOsName = System.getProperty("os.name");

    if (_s_strOsName == null) MySystem.s_printOutExit(strMethod, "nil _s_strOsName");

    if (_s_strOsName.toLowerCase().startsWith(_f_s_strOsUnixSunOS)) {
      MySystem.s_printOutTrace(strMethod, "got:" + _s_strOsName);
      return true;
    }

    return false;
  }
Exemplo n.º 11
0
  /**
   * if any error in code, exiting in case of trbrl: open up a warning dialog, and return false;
   *
   * <p>algo: . get fileOpen keystore . open keystore . fill in table entries . show dialog keystore
   * . enter new alias for trusted certificate entry candidate . create new tcr from crt file .
   * assign new entry to open keystore . save keystore
   */
  public boolean doJob() {
    String strMethod = "doJob()";

    if (!super.doJob()) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    super._setEnabledCursorWait_(true);

    // ---
    // get file keystore

    // memo: keystore should be of type "Uber", provided by "?"
    File fleOpenKst = UtilJsrFile.s_getFileOpen(super._frmOwner_, super._strPathAbsKst_);

    if (fleOpenKst == null) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "nil fleOpenKst");
      return false;
    }

    // ----
    // open keystore

    if (super._chrsPasswdKst_ == null) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutExit(this, strMethod, "nil super._chrsPasswdKst_");
    }

    KeyStore kstOpen =
        UtilKstUber.s_getKeystoreOpen(super._frmOwner_, fleOpenKst, super._chrsPasswdKst_);

    if (kstOpen == null) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "nil kstOpen");
      return false;
    }

    if (!super._doJob_(fleOpenKst, kstOpen)) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    super._setEnabledCursorWait_(false);

    // ending
    return true;
  }
  protected void _showDialog_() {
    String strMethod = "_showDialog_()";
    String strButtonTextOk = "Open directory";

    File fle = S_FileChooserAbs.s_getOpenDir(super._frmParent_, strButtonTextOk);

    if (fle == null) {
      // cancelled
      return;
    }

    if (!_assignValues(fle))
      MySystem.s_printOutExit(this, strMethod, "failed, fle.getName()=" + fle.getName());
  }
Exemplo n.º 13
0
  public static boolean s_isUOther() {
    String strMethod = _f_s_strClass + "s_isUOther()";

    if (_s_strOsName == null) _s_strOsName = System.getProperty("os.name");

    if (_s_strOsName == null) MySystem.s_printOutExit(strMethod, "nil _s_strOsName");

    for (int i = 0; i < _f_s_strsOsUnixOther.length; i++) {
      if (_s_strOsName.toLowerCase().startsWith(_f_s_strsOsUnixOther[i])) {
        MySystem.s_printOutTrace(strMethod, "got:" + _s_strOsName);
        return true;
      }
    }

    return false;
  }
Exemplo n.º 14
0
  public static void s_fill(Manifest man) {
    String strMethod = _f_s_strClass + "s_fill(man)";

    if (man == null) {
      MySystem.s_printOutExit(strMethod, "nil man");
    }

    Attributes attAttributes = man.getMainAttributes();

    attAttributes.putValue(
        S_Manifest._f_s_strsDefaultEntryManifVersion[0],
        S_Manifest._f_s_strsDefaultEntryManifVersion[1]);

    attAttributes.putValue(
        S_Manifest._f_s_strsDefaultEntryManifCreator[0],
        S_Manifest._f_s_strsDefaultEntryManifCreator[1]);
  }
Exemplo n.º 15
0
  public static boolean s_isWinPro() {
    String strMethod = _f_s_strClass + "s_isWinPro()";

    if (!s_isWindows()) return false;

    if (s_isWinPub()) return false;

    if (_s_strOsName == null) MySystem.s_printOutExit(strMethod, "nil _s_strOsName");

    if (_s_strOsName.toLowerCase().endsWith("nt")
        || _s_strOsName.toLowerCase().endsWith("2000")
        || _s_strOsName.toLowerCase().endsWith("xp")) return true;

    MySystem.s_printOutWarning(
        strMethod, "unknown OS, assuming WinPro, _s_strOsName=" + _s_strOsName);

    return true;
  }
Exemplo n.º 16
0
  public CBIcon(ActionListener actListenerParent, ImageIcon iin, String strTip) {
    super(actListenerParent, strTip);

    String strMethod = "CBIcon(...)";

    if (iin == null) MySystem.s_printOutExit(this, strMethod, "nil iin");

    setIcon(iin);
    // FIXING UP BUG jdk1.3.0-final (not in jdk1.2.2 or in jdk1.3.0beta) ...
    setSelectedIcon(iin);
    setDisabledIcon(null);
    setDisabledSelectedIcon(null);
    // ... if disabled & selected, icon not shown as grayed

    setBorderPainted(true);

    setHorizontalAlignment(CENTER);
    setVerticalAlignment(CENTER);
  }
Exemplo n.º 17
0
  public void setSelectedTaskJarToSig() {
    String strMethod = "setSelectedTaskJarToSig()";

    IFAbs ifeTarget = null;

    for (int i = 0; i < super.getComponentCount(); i++) {
      Object objCur = super.getComponent(i);

      if (!(objCur instanceof IFAbs)) continue;

      IFAbs ifeCur = (IFAbs) objCur;

      if (ifeCur instanceof IFKstOpenJarVerif) {
        ifeTarget = ifeCur;
        continue;
      }

      if (ifeCur.isVisible()) ifeCur.setVisible(false);
    }

    if (ifeTarget == null) // !! BUG
    return;

    if (ifeTarget.isIcon()) {
      try {
        ifeTarget.setIcon(false);
      } catch (PropertyVetoException ex) {
        ex.printStackTrace();
        MySystem.s_printOutExit(this, strMethod, ex.getMessage() + "\n exiting");
      }
    }

    if (!ifeTarget.isVisible()) ifeTarget.setVisible(true);

    ifeTarget.toFront();
  }
  /**
   * if any error in code, exiting in case of trbrl: open up a warning dialog, and return false;
   *
   * <p>algo:
   *
   * <p>. add providers
   *
   * <p>. open keystoreSource . open keystoreKstTarget . select aliasSource pointing to valid
   * kprSource . get respective keySource & crtsSource
   *
   * <p>. create new keypair . create new certificate of type X.509 . assign new entry to open
   * [JKS-JCEKS-PKCS12-BKS-UBER] keystore . save [JKS-JCEKS-PKCS12-BKS-UBER] keystore
   */
  protected boolean _doJob_(KeyStore kstOpenSource, KeyStore kstOpenTarget, File fleOpenKstTarget) {
    String strMethod = "_doJob_(kstOpenSource, kstOpenTarget, fleOpenKstTarget)";

    if (kstOpenSource == null || kstOpenTarget == null || fleOpenKstTarget == null)
      MySystem.s_printOutExit(this, strMethod, "nil arg");

    // --
    // . select aliasSource and password pointing to valid kprSource

    // ----
    // get aliases

    // NEW

    String[] strsAliasPKTCSource = UtilKstAbs.s_getStrsAliasPKTC(super._frmOwner_, kstOpenSource);

    if (strsAliasPKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil strsAliasPKTCSource");
    }

    String[] strsAliasSKSource = UtilKstAbs.s_getStrsAliasSK(super._frmOwner_, kstOpenSource);

    if (strsAliasSKSource == null) {
      MySystem.s_printOutExit(strMethod, "nil strsAliasPKTCSource");
    }

    // --
    // get arrays for dialogTableSelectKeypair
    // TC versus PK
    Boolean[] boosIsTCEntryPKTCSource =
        UtilKstAbs.s_getBoosEntryTcr(super._frmOwner_, kstOpenSource, strsAliasPKTCSource);

    if (boosIsTCEntryPKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil boosIsTCEntryPKTCSource");
    }

    Boolean[] boosValidDatePKTCSource =
        UtilKstAbs.s_getBoosValidDatePKTC(super._frmOwner_, kstOpenSource, strsAliasPKTCSource);

    if (boosValidDatePKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil boosValidDatePKTCSource");
    }

    Boolean[] boosSelfSignedCertPKTCSource =
        UtilKstAbs.s_getBoosSelfSigned(super._frmOwner_, kstOpenSource, strsAliasPKTCSource);

    if (boosSelfSignedCertPKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil boosSelfSignedCertPKTCSource");
    }

    Boolean[] boosTrustedCertPKTCSource =
        UtilKstAbs.s_getBoosTrusted(super._frmOwner_, kstOpenSource, strsAliasPKTCSource);

    if (boosTrustedCertPKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil boosTrustedCertPKTCSource");
    }

    String[] strsSizeKeyPublPKTCSource =
        UtilKstAbs.s_getStrsSizeKeyPubl(super._frmOwner_, kstOpenSource, strsAliasPKTCSource);

    if (strsSizeKeyPublPKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil strsSizeKeyPublPKTCSource");
    }

    String[] strsTypeCertPKTCSource =
        UtilKstAbs.s_getStrsTypeCertificatePKTC(
            super._frmOwner_, kstOpenSource, strsAliasPKTCSource);

    if (strsTypeCertPKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil strsTypeCertPKTCSource");
    }

    String[] strsAlgoSigCertPKTCSource =
        UtilKstAbs.s_getStrsAlgoSigCertPKTC(super._frmOwner_, kstOpenSource, strsAliasPKTCSource);

    if (strsAlgoSigCertPKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil strsAlgoSigCertPKTCSource");
    }

    Date[] dtesLastModifiedPKTCSource =
        UtilKstAbs.s_getDtesLastModified(super._frmOwner_, kstOpenSource, strsAliasPKTCSource);

    if (dtesLastModifiedPKTCSource == null) {
      MySystem.s_printOutExit(strMethod, "nil dtesLastModifiedPKTCSource");
    }

    Date[] dtesLastModifiedSKSource =
        UtilKstAbs.s_getDtesLastModified(super._frmOwner_, kstOpenSource, strsAliasSKSource);

    if (dtesLastModifiedSKSource == null) {
      MySystem.s_printOutExit(strMethod, "nil dtesLastModifiedPKTCSource");
    }

    /*String[] strsAliasSource = UtilKstAbs.s_getStrsAlias(
        super._frmOwner_,

        kstOpenSource);

    if (strsAliasSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsAliasSource");
        return false;
    }

    // ----
    // check for existing aliases

    if (strsAliasSource.length < 1)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutWarning(this, strMethod, "strsAliasSource.length < 1");

        String strBody = "source keystore does not contain any entry.";


        OPAbstract.s_showDialogInfo(
            super._frmOwner_, strBody);

        return false;
    }

    // --
    // fill in table for dialogSelect

    Boolean[] boosEntryTcrSource = UtilKstAbs.s_getBoosEntryTcr(
        super._frmOwner_, kstOpenSource, strsAliasSource);

    if (boosEntryTcrSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosEntryTcrSource");
        return false;
    }

    Boolean[] boosEntryKprSource = UtilKstAbs.s_getBoosEntryKpr(
        super._frmOwner_, kstOpenSource, strsAliasSource);

    if (boosEntryKprSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosEntryKprSource");
        return false;
    }

    Boolean[] boosSelfSignedCertSource = UtilKstAbs.s_getBoosSelfSigned(
        super._frmOwner_, kstOpenSource, strsAliasSource);

    if (boosSelfSignedCertSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosSelfSignedCertSource");
        return false;
    }


    Boolean[] boosTrustedCertSource =
        UtilKstAbs.s_getBoosTrusted(super._frmOwner_, kstOpenSource, strsAliasSource);

    if (boosTrustedCertSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosTrustedCertSource");
        return false;
    }

    String[] strsSizeKeyPublSource = UtilKstAbs.s_getStrsSizeKeyPubl(super._frmOwner_, kstOpenSource, strsAliasSource);

    if (strsSizeKeyPublSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsSizeKeyPublSource");
        return false;
    }

    String[] strsAlgoKeyPublSource = UtilKstAbs.s_getStrsAlgoKeyPubl(super._frmOwner_, kstOpenSource, strsAliasSource);

    if (strsAlgoKeyPublSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsAlgoKeyPublSource");
        return false;
    }

    String[] strsTypeCertSource = UtilKstAbs.s_getStrsTypeCertificatePKTC(super._frmOwner_, kstOpenSource, strsAliasSource);

    if (strsTypeCertSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsTypeCertSource");
        return false;
    }

    String[] strsAlgoSigCertSource = UtilKstAbs.s_getStrsAlgoSigCertPKTC(super._frmOwner_, kstOpenSource, strsAliasSource);

    if (strsAlgoSigCertSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsAlgoSigCertSource");
        return false;
    }

    Date[] dtesLastModifiedSource = UtilKstAbs.s_getDtesLastModified(super._frmOwner_, kstOpenSource, strsAliasSource);

    if (dtesLastModifiedSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil dtesLastModifiedSource");
        return false;
    }

    // ----

    Boolean[] boosTypeCertX509Source = super._getBoosTypeCertX509_(kstOpenSource, strsAliasSource);

    if (boosTypeCertX509Source == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosTypeCertX509Source");
        return false;
    }

    Boolean[] boosElligibleSource = super._getBoosElligibleAny_(
        boosEntryKprSource, strsAlgoKeyPublSource,
        boosTypeCertX509Source);

    if (boosElligibleSource == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosElligibleSource");
        return false;
    }

    // --
    // clean-up
    boosTypeCertX509Source = null;

    // ---
    // check for elligible entry

    boolean blnElligible = false;

    for (int i=0; i<boosElligibleSource.length; i++)
    {
        if (boosElligibleSource[i].booleanValue() == true)
        {
            blnElligible = true;
            break;
        }
    }

    if (! blnElligible)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "! blnElligible");

        String strBody = "source keystore does not contain any keypair entry\n either of type RSA, or of type DSA, with an X.509 certificate .";

        OPAbstract.s_showDialogInfo(
            super._frmOwner_, strBody);

        return false;
    }*/

    // --
    // assign default cursor

    super._setEnabledCursorWait_(false);

    // ----

    /*DTblEntryKprOpenKPAny dlgSource = new DTblEntryKprOpenKPAny(
    super._frmOwner_,
    super._strTitleAppli_,
    kstOpenSource
    );*/

    DTblsKstSelPKOpen dlgSource =
        new DTblsKstSelPKOpen(
            super._frmOwner_,
            kstOpenSource,
            super._strPathAbsKst_,
            "Import private key from other keystore - step 1/2: source");

    if (!dlgSource.init()) MySystem.s_printOutExit(this, strMethod, "failed");

    //
    if (!dlgSource.load(
        strsAliasPKTCSource,
        boosIsTCEntryPKTCSource,
        boosValidDatePKTCSource,
        boosSelfSignedCertPKTCSource,
        boosTrustedCertPKTCSource,
        strsSizeKeyPublPKTCSource,
        strsTypeCertPKTCSource,
        strsAlgoSigCertPKTCSource,
        dtesLastModifiedPKTCSource,
        // below: about SK (Secret Key)
        strsAliasSKSource,
        dtesLastModifiedSKSource

        /*boosElligibleSource, strsAliasSource,
        boosEntryKprSource,
        boosEntryTcrSource,
        boosSelfSignedCertSource,
        boosTrustedCertSource,
        strsAlgoKeyPublSource,
        strsSizeKeyPublSource,
        strsTypeCertSource,
        strsAlgoSigCertSource, dtesLastModifiedSource*/ )) {
      MySystem.s_printOutExit(this, strMethod, "failed");
    }

    dlgSource.setVisible(true);

    // ---
    char[] chrsPasswdKprSource = dlgSource.getPassword();

    if (chrsPasswdKprSource == null) {
      MySystem.s_printOutTrace(this, strMethod, "nil chrsPasswdKprSource, aborted by user");
      return false;
    }

    String strAliasKprSource = dlgSource.getAlias();

    if (strAliasKprSource == null) {
      MySystem.s_printOutTrace(this, strMethod, "nil strAliasKprSource, aborted by user");
      return false;
    }

    // super._setEnabledCursorWait_(true);

    // at this level, user selected keypair (got alias & password)

    // --
    // . get respective keySource & crtsSource

    // ----
    // x) get privateKey

    PrivateKey pkySource = null;

    try {
      pkySource =
          (PrivateKey)
              UtilKstAbs.s_getKey(
                  super._frmOwner_, kstOpenSource, strAliasKprSource, chrsPasswdKprSource);
    } catch (ClassCastException excClassCast) {
      excClassCast.printStackTrace();
      MySystem.s_printOutExit(this, strMethod, "excClassCast caught");
    }

    if (pkySource == null) {
      MySystem.s_printOutError(this, strMethod, "nil pkySource");
      return false;
    }

    // ----
    // x) get X509Certificates

    X509Certificate[] crtsX509UnorderedSource =
        UtilCrtX509.s_getX509CertificateChain(
            kstOpenSource,
            strAliasKprSource,
            false // blnOrderChain !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            );

    if (crtsX509UnorderedSource == null) {
      MySystem.s_printOutError(this, strMethod, "nil crtsX509UnorderedSource");
      return false;
    }

    // -----

    if (!__createNewEntry__(kstOpenTarget, pkySource, crtsX509UnorderedSource)) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    // ----
    // save kstOpenTarget

    if (super._chrsPasswdKst_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil super._chrsPasswdKst_");
      return false;
    }

    // ----

    if (!super._saveKeyStore_(kstOpenTarget, fleOpenKstTarget, super._chrsPasswdKst_)) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    // ending
    return true;
  }
  protected boolean __doJob__(
      KeyStore kstOpen,
      String[] strsAliasPKTC,
      Boolean[] boosIsTCEntryPKTC,
      Boolean[] boosValidDatePKTC,
      Boolean[] boosSelfSignedCertPKTC,
      Boolean[] boosTrustedCertPKTC,
      String[] strsSizeKeyPublPKTC,
      String[] strsTypeCertPKTC,
      String[] strsAlgoSigCertPKTC,
      Date[] dtesLastModifiedPKTC,
      String[] strsAliasSK,
      Date[] dtesLastModifiedSK) {
    String strMethod = "__doJob__(...)";
    // ----

    // MEMO: overwriting alias-key not allowed
    // -----

    // ----
    // show dialog KeyPair new Ec
    //  . get aliasKpr
    //  . get passwdKpr

    DTblsKstViewKeySavePKNoPass dlg =
        new DTblsKstViewKeySavePKNoPass(
            (Component) super._frmOwner_,
            kstOpen,
            super._strPathAbsKst_,
            "Create EC (Elliptic Curve) private key entry");

    if (!dlg.init()) MySystem.s_printOutExit(this, strMethod, "failed");

    //
    if (!dlg.load(

        // below: about PKTC (Private Key & Trusted Certificate)
        strsAliasPKTC,
        boosIsTCEntryPKTC,
        boosValidDatePKTC,
        boosSelfSignedCertPKTC,
        boosTrustedCertPKTC,
        strsSizeKeyPublPKTC,
        strsTypeCertPKTC,
        strsAlgoSigCertPKTC,
        dtesLastModifiedPKTC,
        // below: about SK (Secret Key)
        strsAliasSK,
        dtesLastModifiedSK)) {
      MySystem.s_printOutExit(this, strMethod, "failed");
    }

    dlg.setVisible(true);

    // ---
    char[] chrsPasswdKpr = dlg.getPassword();

    if (chrsPasswdKpr == null) {
      MySystem.s_printOutTrace(this, strMethod, "nil chrsPasswdKpr, aborted by user");
      return false;
    }

    String strAliasKpr = dlg.getAlias();

    if (strAliasKpr == null) {
      MySystem.s_printOutTrace(this, strMethod, "nil strAliasKpr, aborted by user");
      return false;
    }

    // ----
    // create new KeyPair

    KeyPair kprNew = super._getKprNew_();

    if (kprNew == null) {
      MySystem.s_printOutError(this, strMethod, "nil kprNew");
      return false;
    }

    // ----
    // create new certificate of type X.509
    // memo: sig algo: MD5withRSA, MD2withRSA, SHA1withRSA, (RIPEMD160withRSA: IN COMMENTS, not
    // supported by SunEcSign)
    X509Certificate crtNew = super._getX509CertNew_(kprNew);

    if (crtNew == null) {
      MySystem.s_printOutError(this, strMethod, "nil crtNew");
      return false;
    }

    // ----
    // assign new entry to open keystore

    if (!super._assignNewEntry2OpenKeystore_(kstOpen, kprNew, crtNew, strAliasKpr, chrsPasswdKpr)) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    return true;
  }
  /**
   * if any error in code, exiting in case of trbrl: open up a warning dialog, and return false;
   *
   * <p>algo:
   *
   * <p>. add providers
   *
   * <p>. open keystoreSource . open keystoreTarget . select aliasSource pointing to valid kprSource
   * . get respective keySource & crtsSource
   *
   * <p>. create new KeyPair . create new certificate of type X.509 . assign new entry to open BKS
   * keystore . save BKS keystore
   */
  public boolean doJob() {
    String strMethod = "doJob()";

    File fleOpenKstSource =
        UtilJsrFile.s_getFileOpen(super._frmOwner_, super._strPathAbsKstSource_);

    if (fleOpenKstSource == null) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "nil fleOpenKstSource");
      return false;
    }

    File fleOpenKstTarget = UtilJsrFile.s_getFileOpen(super._frmOwner_, super._strPathAbsKst_);

    if (fleOpenKstTarget == null) {
      MySystem.s_printOutError(this, strMethod, "nil fleOpenKstTarget");
      return false;
    }

    // --
    // . open keystoreSource

    if (super._chrsPasswdKstSource_ == null) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutExit(this, strMethod, "nil super._chrsPasswdKstSource_");
    }

    KeyStore kstOpenSource =
        UtilKstUber.s_getKeystoreOpen(
            super._frmOwner_, fleOpenKstSource, super._chrsPasswdKstSource_);

    if (kstOpenSource == null) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "nil kstOpenSource");
      return false;
    }

    // ----
    // open keystore target

    if (super._chrsPasswdKst_ == null)
      MySystem.s_printOutExit(this, strMethod, "nil super._chrsPasswdKst_");

    KeyStore kstOpenTarget =
        UtilKstBks.s_getKeystoreOpen(super._frmOwner_, fleOpenKstTarget, super._chrsPasswdKst_);

    if (kstOpenTarget == null) {
      MySystem.s_printOutError(this, strMethod, "nil kstOpenTarget");
      return false;
    }

    super._setEnabledCursorWait_(true);

    if (!super._doJob_(kstOpenSource, kstOpenTarget, fleOpenKstTarget)) {
      super._setEnabledCursorWait_(false);
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    super._setEnabledCursorWait_(false);

    // ending
    return true;
  }
  protected boolean __createNewEntry__(
      KeyStore kstOpenTarget, PrivateKey pkyPrivateSource, Certificate[] crtsSource) {
    String strMethod = "__createNewEntry__(...)";

    // NEW

    String[] strsAliasPKTC = UtilKstAbs.s_getStrsAliasPKTC(super._frmOwner_, kstOpenTarget);

    if (strsAliasPKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil strsAliasPKTC");
    }

    String[] strsAliasSK = UtilKstAbs.s_getStrsAliasSK(super._frmOwner_, kstOpenTarget);

    if (strsAliasSK == null) {
      MySystem.s_printOutExit(strMethod, "nil strsAliasPKTC");
    }

    // --
    // get arrays for dialogTableSelectKeypair
    // TC versus PK
    Boolean[] boosIsTCEntryPKTC =
        UtilKstAbs.s_getBoosEntryTcr(super._frmOwner_, kstOpenTarget, strsAliasPKTC);

    if (boosIsTCEntryPKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil boosIsTCEntryPKTC");
    }

    Boolean[] boosValidDatePKTC =
        UtilKstAbs.s_getBoosValidDatePKTC(super._frmOwner_, kstOpenTarget, strsAliasPKTC);

    if (boosValidDatePKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil boosValidDatePKTC");
    }

    Boolean[] boosSelfSignedCertPKTC =
        UtilKstAbs.s_getBoosSelfSigned(super._frmOwner_, kstOpenTarget, strsAliasPKTC);

    if (boosSelfSignedCertPKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil boosSelfSignedCertPKTC");
    }

    Boolean[] boosTrustedCertPKTC =
        UtilKstAbs.s_getBoosTrusted(super._frmOwner_, kstOpenTarget, strsAliasPKTC);

    if (boosTrustedCertPKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil boosTrustedCertPKTC");
    }

    String[] strsSizeKeyPublPKTC =
        UtilKstAbs.s_getStrsSizeKeyPubl(super._frmOwner_, kstOpenTarget, strsAliasPKTC);

    if (strsSizeKeyPublPKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil strsSizeKeyPublPKTC");
    }

    String[] strsTypeCertPKTC =
        UtilKstAbs.s_getStrsTypeCertificatePKTC(super._frmOwner_, kstOpenTarget, strsAliasPKTC);

    if (strsTypeCertPKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil strsTypeCertPKTC");
    }

    String[] strsAlgoSigCertPKTC =
        UtilKstAbs.s_getStrsAlgoSigCertPKTC(super._frmOwner_, kstOpenTarget, strsAliasPKTC);

    if (strsAlgoSigCertPKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil strsAlgoSigCertPKTC");
    }

    Date[] dtesLastModifiedPKTC =
        UtilKstAbs.s_getDtesLastModified(super._frmOwner_, kstOpenTarget, strsAliasPKTC);

    if (dtesLastModifiedPKTC == null) {
      MySystem.s_printOutExit(strMethod, "nil dtesLastModifiedPKTC");
    }

    Date[] dtesLastModifiedSK =
        UtilKstAbs.s_getDtesLastModified(super._frmOwner_, kstOpenTarget, strsAliasSK);

    if (dtesLastModifiedSK == null) {
      MySystem.s_printOutExit(strMethod, "nil dtesLastModifiedPKTC");
    }

    /*
    // ----
    // create new alias (?& new password)


    // ----
    // fill in table KeyPair

    String[] strsAliasTarget = UtilKstAbs.s_getStrsAlias(
        super._frmOwner_,

        kstOpenTarget);

    if (strsAliasTarget == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsAliasTarget");
        return false;
    }

    // --

    Boolean[] boosEntryKpr = UtilKstAbs.s_getBoosEntryKpr(
        super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (boosEntryKpr == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosEntryKpr");
        return false;
    }

    Boolean[] boosEntryTcr = UtilKstAbs.s_getBoosEntryTcr(
        super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (boosEntryTcr == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosEntryTcr");
        return false;
    }


    Boolean[] boosSelfSignedCert = UtilKstAbs.s_getBoosSelfSigned(
        super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (boosSelfSignedCert == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosSelfSignedCert");
        return false;
    }

    Boolean[] boosTrustedCert =
        UtilKstAbs.s_getBoosTrusted(super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (boosTrustedCert == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil boosTrustedCert");
        return false;
    }

    String[] strsAlgoKeyPubl = UtilKstAbs.s_getStrsAlgoKeyPubl(
        super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (strsAlgoKeyPubl == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsAlgoKeyPubl");
        return false;
    }

    String[] strsSizeKeyPubl = UtilKstAbs.s_getStrsSizeKeyPubl(
        super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (strsSizeKeyPubl == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsSizeKeyPubl");
        return false;
    }

    String[] strsTypeCert = UtilKstAbs.s_getStrsTypeCertificatePKTC(super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (strsTypeCert == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsTypeCert");
        return false;
    }

    String[] strsAlgoSigCert = UtilKstAbs.s_getStrsAlgoSigCertPKTC(super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (strsAlgoSigCert == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil strsAlgoSigCert");
        return false;
    }

    Date[] dtesLastModified = UtilKstAbs.s_getDtesLastModified(super._frmOwner_, kstOpenTarget, strsAliasTarget);

    if (dtesLastModified == null)
    {
        super._setEnabledCursorWait_(false);
        MySystem.s_printOutError(this, strMethod, "nil dtesLastModified");
        return false;
    }*/

    // --
    // assign default cursor

    super._setEnabledCursorWait_(false);

    // ----

    // MEMO: overwriting alias-key not allowed
    // -----

    // ----
    // show dialog KeyPair new entry
    //  . get aliasKpr
    //  . get passwdKpr

    /*DTblEntryKprSaveAny dlgTarget = new DTblEntryKprSaveAny(
    super._frmOwner_,
    super._strTitleAppli_,
    kstOpenTarget,
    super._blnIsPasswdKprTarget_ // blnIsPassword
    );*/

    DTblsKstViewKeySavePK dlgTarget =
        new DTblsKstViewKeySavePK(
            super._frmOwner_,
            kstOpenTarget,
            super._strPathAbsKst_,
            "Import private key from other keystore - step 2/2: target");

    if (!dlgTarget.init()) MySystem.s_printOutExit(this, strMethod, "failed");

    //
    if (!dlgTarget.load(
        // below: about PKTC (Private Key & Trusted Certificate)
        strsAliasPKTC,
        boosIsTCEntryPKTC,
        boosValidDatePKTC,
        boosSelfSignedCertPKTC,
        boosTrustedCertPKTC,
        strsSizeKeyPublPKTC,
        strsTypeCertPKTC,
        strsAlgoSigCertPKTC,
        dtesLastModifiedPKTC,
        // below: about SK (Secret Key)
        strsAliasSK,
        dtesLastModifiedSK
        /*strsAliasTarget,
        boosEntryKpr, boosEntryTcr,
        boosSelfSignedCert, boosTrustedCert,
        strsAlgoKeyPubl,
        strsSizeKeyPubl,
        strsTypeCert, strsAlgoSigCert, dtesLastModified*/ )) {
      MySystem.s_printOutExit(this, strMethod, "failed");
    }

    dlgTarget.setVisible(true);

    char[] chrsPasswdKprTarget = new char[0]; // no password, eg, for PKCS12

    // ---
    if (super._blnIsPasswdKprTarget_) {
      chrsPasswdKprTarget = dlgTarget.getPassword();

      if (chrsPasswdKprTarget == null) {
        MySystem.s_printOutTrace(this, strMethod, "nil chrsPasswdKprTarget, aborted by user");
        return false;
      }
    }

    String strAliasKprTarget = dlgTarget.getAlias();

    if (strAliasKprTarget == null) {
      MySystem.s_printOutTrace(this, strMethod, "nil strAliasKprTarget, aborted by user");
      return false;
    }

    // ----
    // store privateKeySource & crtsSource associated with alias (?& password) in kstOpenTarget

    if (!UtilKstAbs.s_setKeyEntry(
        super._frmOwner_,
        kstOpenTarget,
        strAliasKprTarget,
        pkyPrivateSource,
        chrsPasswdKprTarget,
        crtsSource)) {
      MySystem.s_printOutError(this, strMethod, "failed");
      return false;
    }

    return true;
  }