-
大小: 15KB文件类型: .java金币: 1下载: 0 次发布日期: 2021-05-10
- 语言: Java
- 标签: diffie-hellm
资源简介
Diffie-Hellman算法的目的是使得两个用户能够安全地交换密钥,供以后加密消息时使用。
代码片段和文件信息
package Diffie;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.Date;
//定义对话框类
class A_q_dialog extends Dialog implements ActionListener
{
int message;
Panel panel_dialog;
Button button_queding;
Label label_jinggao;
A_q_dialog(frame fString sboolean bString jinggao)
{
super(fsb);
panel_dialog=new Panel();
panel_dialog.setLayout(null);
label_jinggao=new Label(jinggao);
panel_dialog.add(label_jinggao);
label_jinggao.setBounds(2 2 145 40);
button_queding=new Button(“确定“);
panel_dialog.add(button_queding);
button_queding.setBounds(150/2-80/2448030);
button_queding.addActionListener(this);
add(panel_dialog);
Toolkit tool=getToolkit();
Dimension dim=tool.getScreenSize();
setBounds(dim.width/2-120/2dim.height/2-150/2150120);
addWindowListener(new WindowAdapter( )
{
public void windowClosing(WindowEvent e)
{
message=-1;
setVisible(false);
}
}
);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==button_queding)
{
message=1;
setVisible(false);
}
}
}
class DFframe extends frame implements ActionListener
{
//定义变量——警告对话框
A_q_dialog dialog_adialog_qdialog_a_siyaodialog_b_siyao
dialog_a_qdialog_sushudialog_zhengshudialog_ling
dialog_o_b_gongyaodialog_o_a_siyaodialog_o_b_siyao
dialog_o_a_gongyao;
//定义变量——重置
Button button_chongzhi;
Panel panel_chongzhi;
//定义变量——输入a与素数q
String string_qstring_a;
long long_qlong_a;
Panel shuru_a_q;
Label label_qlabel_alabel_q_jinggaolebel_a_jinggao;
TextField textfield_atextfield_q;
//定义变量——输入A的私钥生成公钥
long long_a_siyaolong_a_gongyao;
String string_a_siyaostring_a_gongyao;
Button button_shengcheng_a_gongyao;
TextField textfield_a_siyaotextfield_a_gongyao;
Label label_a_siyaolabel_a_gongyao;
Panel panel_a_gongyao_siyao;
//定义变量——输入B的私钥生成公钥
long long_b_siyaolong_b_gongyao;
String string_b_siyaostring_b_gongyao;
Button button_shengcheng_b_gongyao;
TextField textfield_b_siyaotextfield_b_gongyao;
Label label_b_siyaolabel_b_gongyao;
Panel panel_b_gongyao_siyao;
//定义变量——A生成公共密钥K
long long_a_chansheng_k;
String string_a_chansheng_k;
Button button_a_shengcheng_k;
TextField textfield_a_shengcheng_k;
Label label_a_shengcheng_k;
Panel panel_a_shengcheng_kpanel_a_shengcheng_k_button
panel_a_shengcheng_button;
//定义变量——B生成公共密钥K
long long_b_chansheng_k;
String string_b_chansheng_k;
Button button_b_shengcheng_k;
TextField textfield_b_shengcheng_k;
Label label_b_shengcheng_k;
Panel panel_b_shengcheng_kpanel_b_shengcheng_k_button
panel_b_shengcheng_button;
DFframe(String s)
{
super(s);
setLayout(null);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
- 上一篇:jsti.jar和standard.jar
- 下一篇:GPMC 与FPGA通信
评论
共有 条评论