public DragEntry dragSelectedEntry(){
  try {
    KeyStoreHistory history=getActiveKeyStoreHistory();
    if (history == null) {
      return null;
    }
    KeyStoreState currentState=history.getCurrentState();
    KeyStore keyStore=currentState.getKeyStore();
    String alias=getSelectedEntryAlias();
    if (alias == null) {
      return null;
    }
    if (KeyStoreUtil.isKeyEntry(alias,keyStore)) {
      JOptionPane.showMessageDialog(frame,res.getString("KseFrame.NoDragKeyEntry.message"),KSE.getApplicationName(),JOptionPane.WARNING_MESSAGE);
      return null;
    }
    if (KeyStoreUtil.isKeyPairEntry(alias,keyStore)) {
      Password password=currentState.getEntryPassword(alias);
      KeyStoreType type=KeyStoreType.resolveJce(keyStore.getType());
      if (password == null && type.hasEntryPasswords()) {
        JOptionPane.showMessageDialog(frame,res.getString("KseFrame.NoDragLockedKeyPairEntry.message"),KSE.getApplicationName(),JOptionPane.WARNING_MESSAGE);
        return null;
      }
      PrivateKey privateKey=(PrivateKey)keyStore.getKey(alias,password.toCharArray());
      Certificate[] certificateChain=keyStore.getCertificateChain(alias);
      return new DragKeyPairEntry(alias,privateKey,password,certificateChain);
    }
 else {
      Certificate trustedCertificate=keyStore.getCertificate(alias);
      return new DragTrustedCertificateEntry(alias,trustedCertificate);
    }
  }
 catch (  Exception ex) {
    DError.displayError(frame,ex);
    return null;
  }
}

public DragEntry dragSelectedEntry ( ) { try { KeyStoreHistory history = getActiveKeyStoreHistory ( ) ; if ( history == null ) { return null ; } KeyStoreState currentState = history . getCurrentState ( ) ; KeyStore keyStore = currentState . getKeyStore ( ) ; String alias = getSelectedEntryAlias ( ) ; if ( alias == null ) { return null ; } if ( KeyStoreUtil . isKeyEntry ( alias , keyStore ) ) { JOptionPane . showMessageDialog ( frame , res . getString ( "KseFrame.NoDragKeyEntry.message" ) , KSE . getApplicationName ( ) , JOptionPane . WARNING_MESSAGE ) ; return null ; } if ( KeyStoreUtil . isKeyPairEntry ( alias , keyStore ) ) { Password password = currentState . getEntryPassword ( alias ) ; KeyStoreType type = KeyStoreType . resolveJce ( keyStore . getType ( ) ) ; if ( password == null && type . hasEntryPasswords ( ) ) { JOptionPane . showMessageDialog ( frame , res . getString ( "KseFrame.NoDragLockedKeyPairEntry.message" ) , KSE . getApplicationName ( ) , JOptionPane . WARNING_MESSAGE ) ; return null ; } PrivateKey privateKey = ( PrivateKey ) keyStore . getKey ( alias , password . toCharArray ( ) ) ; Certificate [ ] certificateChain = keyStore . getCertificateChain ( alias ) ; return new DragKeyPairEntry ( alias , privateKey , password , certificateChain ) ; } else { Certificate trustedCertificate = keyStore . getCertificate ( alias ) ; return new DragTrustedCertificateEntry ( alias , trustedCertificate ) ; } } catch ( Exception ex ) { DError . displayError ( frame , ex ) ; return null ; } }
get a the selected entry as a drag entry for dnd .
