System.out.println("产生的一个私钥为:"+this.private_key); } //输入明文 public void getText()throws Exception { System.out.println("请输入明文:"); BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); String br=stdin.readLine(); this.text=Long.parseLong(br); } //加密、解密计算 public long colum(long y,long n,long key) { long mul; if(key==1) mul=y%n; else mul=y*this.colum(y,n,key-1)%n; return mul; } //加密后解密 public void pascolum()throws Exception { this.getText(); System.out.println("输入明文为: "+this.text); //加密 this.secretword=this.colum(this.text,this.n,this.public_key); System.out.println("所得的密文为:"+this.secretword); //解密 this.word=this.colum(this.secretword,this.n,this.private_key); System.out.println("解密后所得的明文为:"+this.word); } public static void main(String []args)throws Exception { Rsa t = new Rsa(); t.inputPQ();
上一篇:用JVM工具接口创建调试和分析代理
下一篇:JAVA基础:Java 启动器如何查找类
|