⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hcipherapp.java~

📁 文件加密解密程序。内含公开暗号(RAS)加解密工具
💻 JAVA~
📖 第 1 页 / 共 3 页
字号:
            this.jTextArea3.append("jButton6ActionPerformed() : " +e.toString() + "\n\n");        }    }//GEN-LAST:event_jButton6ActionPerformed    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed        // Add your handling code here:        // tab3 reset        ras_infile = null;        ras_outfile_path = "";        jPasswordField_tab3_1.setText("");        jPasswordField_tab3_2.setText("");        jTextField9.setText("");        jTextField10.setText("");        jTextField_Modulus.setText("");        jTextArea3.setText("");    }//GEN-LAST:event_jButton9ActionPerformed    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed        // Add your handling code here:        // tab3 - refer2        if (this.filechooser == null){            filechooser = new JFileChooser();        }        int returnVal = filechooser.showOpenDialog(this);        if (returnVal == filechooser.APPROVE_OPTION){            this.ras_outfile_path = filechooser.getCurrentDirectory().toString();            this.jTextField10.setText(ras_outfile_path);        }    }//GEN-LAST:event_jButton8ActionPerformed    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed        // Add your handling code here:        // tab3 - refer1        if (this.filechooser == null){            filechooser = new JFileChooser();        }        filechooser.setMultiSelectionEnabled(true);        int returnVal = filechooser.showOpenDialog(this);        if (returnVal == filechooser.APPROVE_OPTION){            this.ras_infile = filechooser.getSelectedFiles();            this.ras_outfile_path = filechooser.getCurrentDirectory().toString();            this.jTextField9.setText(ras_infile[0].getName() + "...[" + ras_infile.length + "files]");            this.jTextField10.setText(ras_outfile_path);        }    }//GEN-LAST:event_jButton7ActionPerformed    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed        // Add your handling code here:        // run tab2        String operationtype;        if (this.jRadioButton1.isSelected()){            operationtype = "E";        }else{            operationtype = "D";        }        String password;        String pswd1,pswd2;        pswd1 = new String(jPasswordField_tab1_1.getPassword());        pswd2 = new String(jPasswordField_tab1_2.getPassword());        if ((pswd1.length()>0)&&(pswd1.equals(pswd2))){            password = pswd1;        }else{            jTextArea2.append("Please check the password.\n");            jPasswordField_tab1_2.setText("");            jPasswordField_tab1_1.setText("");            return;         }        try{            jTextField6.setText(new String(hcipher.cipher(jTextField5.getText().getBytes(), password, operationtype)));        }catch(Exception e){            this.jTextArea2.append("jButton5ActionPerformed() : \n" +e.toString() + "\n");        }            }//GEN-LAST:event_jButton5ActionPerformed    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed        // Add your handling code here:        // reset        infile = null;        this.outfile_path = "";        jTextArea1.setText("");        jTextField1.setText("");        jTextField2.setText("");        jPasswordField_tab1_1.setText("");        jPasswordField_tab1_2.setText("");    }//GEN-LAST:event_jButton4ActionPerformed    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed        // Add your handling code here:        // run tab1        try{            boolean delete = this.jCheckBox1.isSelected();            String operationtype;            if (this.jRadioButton1.isSelected()){                operationtype = "E";            }else{                operationtype = "D";            }                        String password;            String pswd1,pswd2;            pswd1 = new String(jPasswordField_tab1_1.getPassword());            pswd2 = new String(jPasswordField_tab1_2.getPassword());            if ((pswd1.length()>0)&&(pswd1.equals(pswd2))){                password = pswd1;            }else{                jTextArea1.append("Please check the password.\n\n");                jPasswordField_tab1_2.setText("");                jPasswordField_tab1_1.setText("");                return;             }                        if (infile == null){                jTextArea1.append("Please select the input files.\n\n");                return;            }                        this.outfile_path = this.jTextField2.getText();                        int filecnt = this.infile.length;            int len;            int count = 0;            for (int i=0;i<filecnt;i++){                try{                    FileInputStream fis = new FileInputStream(infile[i]);                    len = (int)infile[i].length();                    byte[] data = new byte[len];                    fis.read(data);                    fis.close();                    data = hcipher.cipher(data, password, operationtype);                    String outfile;                    if (operationtype.equals("E")){                        outfile = outfile_path + "\\" + infile[i].getName() + FILETYPE;                    }else{                        if (outfile.indexOf(this.FILETYPE)>0){                            outfile = outfile_path + "\\" + infile[i].getName();                            outfile = outfile.substring(0,outfile.length() - 4);                        }else{                            outfile = outfile_path + "\\uc_" + infile[i].getName();                        }                    }                    if ((new File(outfile).exists())&&(operationtype.equals("D"))){                        this.jTextArea1.append("Run() : " + (new File(outfile)).getName() + " is already existsed.\n");                    }else{                        FileOutputStream fos = new FileOutputStream(outfile);                        fos.write(data);                        fos.close();                        if (delete){                            infile[i].delete();                        }                        count ++;                    }                 }catch(Exception e){                    this.jTextArea1.append("Run() : " + infile[i].getName() + " " + e.toString() + "\n");                }            }            this.jTextArea1.append(count + "/" + filecnt + " complated.\n\n");                    }catch(Exception e){            this.jTextArea1.append("jButton3ActionPerformed() : \n" +e.toString() + "\n\n");        }    }//GEN-LAST:event_jButton3ActionPerformed    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed        // Add your handling code here:        // tab1 refer outfiles        if (this.filechooser == null){            filechooser = new JFileChooser();        }        int returnVal = filechooser.showOpenDialog(this);        if (returnVal == filechooser.APPROVE_OPTION){            this.outfile_path = filechooser.getCurrentDirectory().toString();            this.jTextField2.setText(outfile_path);        }    }//GEN-LAST:event_jButton2ActionPerformed    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed        // Add your handling code here:        // tab2 refer infiles        if (this.filechooser == null){            filechooser = new JFileChooser();        }        filechooser.setMultiSelectionEnabled(true);        int returnVal = filechooser.showOpenDialog(this);        if (returnVal == filechooser.APPROVE_OPTION){            this.infile = filechooser.getSelectedFiles();            this.outfile_path = filechooser.getCurrentDirectory().toString();            this.jTextField1.setText(infile[0].getName() + "...[" + infile.length + "files]");            this.jTextField2.setText(outfile_path);        }    }//GEN-LAST:event_jButton1ActionPerformed        /** Exit the Application */    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm        System.exit(0);    }//GEN-LAST:event_exitForm        /**     * @param args the command line arguments     */    public static void main(String args[]) {        new HCipherApp().show();    }            // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JTextField jTextField6;    private javax.swing.JButton jButton2;    private javax.swing.JPanel jPanel16;    private javax.swing.JTextArea jTextArea2;    private javax.swing.JPanel jPanel19;    private javax.swing.JRadioButton jRadioButton1;    private javax.swing.JButton jButton7;    private javax.swing.JPanel jPanel13;    private javax.swing.JButton jButton8;    private javax.swing.JPanel jPanel10;    private javax.swing.JRadioButton jRadioButton3;    private javax.swing.JTextField jTextField_Modulus;    private javax.swing.JButton jButton3;    private javax.swing.JTextField jTextField5;    private javax.swing.JLabel jLabel9;    private javax.swing.JButton jButton9;    private javax.swing.JPanel jPanel12;    private javax.swing.JTextField jTextField10;    private javax.swing.JRadioButton jRadioButton2;    private javax.swing.JTextArea jTextArea1;    private javax.swing.JPanel jPanel7;    private javax.swing.JPanel jPanel1;    private javax.swing.JTextField jTextField2;    private javax.swing.JPanel jPanel6;    private javax.swing.JCheckBox jCheckBox2;    private javax.swing.ButtonGroup buttonGroup2;    private javax.swing.JPanel jPanel14;    private javax.swing.JLabel jLabel6;    private javax.swing.JComboBox jComboBox1;    private javax.swing.JTextField jTextField1;    private javax.swing.JTabbedPane jTabbedPane1;    private javax.swing.JLabel jLabel5;    private javax.swing.JLabel jLabel8;    private javax.swing.JLabel jLabel4;    private javax.swing.JLabel jLabel71;    private javax.swing.JTextField jTextField9;    private javax.swing.JPanel jPanel4;    private javax.swing.JScrollPane jScrollPane1;    private javax.swing.JLabel jLabel1;    private javax.swing.JPanel jPanel25;    private javax.swing.JLabel jLabel3;    private javax.swing.JPanel jPanel3;    private javax.swing.JLabel jLabel2;    private javax.swing.JButton jButton1;    private javax.swing.JButton jButton_TAB2_Reset;    private javax.swing.JPanel jPanel24;    private javax.swing.JTextArea jTextArea3;    private javax.swing.JPanel jPanel2;    private javax.swing.JPanel jPanel5;    private javax.swing.JPanel jPanel11;    private javax.swing.JPasswordField jPasswordField_tab3_1;    private javax.swing.JScrollPane jScrollPane2;    private javax.swing.JPasswordField jPasswordField_tab1_2;    private javax.swing.JRadioButton jRadioButton4;    private javax.swing.JButton jButton6;    private javax.swing.JPanel jPanel8;    private javax.swing.JPasswordField jPasswordField_tab1_1;    private javax.swing.JButton jButton5;    private javax.swing.JPanel jPanel22;    private javax.swing.JLabel jLabel11;    private javax.swing.JLabel jLabel7;    private javax.swing.ButtonGroup buttonGroup1;    private javax.swing.JPanel jPanel17;    private javax.swing.JPanel jPanel18;    private javax.swing.JPanel jPanel21;    private javax.swing.JButton jButton4;    private javax.swing.JPasswordField jPasswordField_tab3_2;    private javax.swing.JPanel jPanel20;    private javax.swing.JPanel jPanel15;    private javax.swing.JScrollPane jScrollPane3;    private javax.swing.JCheckBox jCheckBox1;    private javax.swing.JPanel jPanel9;    private javax.swing.JLabel jLabel10;    private javax.swing.JPanel jPanel23;    // End of variables declaration//GEN-END:variables    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -