rsa.java

来自「提供JAVA源码」· Java 代码 · 共 63 行

JAVA
63
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package rsalab;import java.util.Random;import java.math.BigInteger;/** * * @author Fredrik *//** * * @author Fredrik */public class RSA {        private BigInteger n;    private BigInteger e;    private BigInteger d;        //initiate RSA with length of n equal to bitlength     public RSA(int bitLength){        Random rndGen=new Random(1);        //create p and q, size bitlength/2                //calculate n                //calculate fi(n)=(p-1)(q-1)                //create e                //calculate d    }        public byte[] encrypt(byte[] plaintext){               byte[] ciphertext={0,0};        return ciphertext;    }        public byte[] decrypt(byte[] ciphertext){               byte[] plaintext={0,0};        return plaintext;    }        public byte[] getPublicExponent(){        byte[] eBytes=null;        return eBytes;    }        public byte[] getN(){        byte[] nBytes=null;        return nBytes;    }        }

⌨️ 快捷键说明

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