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

📄 main.java

📁 RSA is an asymetric method to crypt message. You can use RSA to crypt the key session of symetric me
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package rsa;import java.math.BigInteger;import java.util.Random;public class Main {    public static void main(String[] args) {       BigInteger p=new BigInteger(512,100,new Random());       BigInteger q=new BigInteger(512,100,new Random());       BigInteger n=p.multiply(q);       BigInteger phin=(p.subtract(BigInteger.ONE)).multiply((q.subtract(BigInteger.ONE)));       BigInteger e=BigInteger.valueOf(65537);       BigInteger d=e.modInverse(phin);       String L="abcde521548762548";       String M="0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";       String C=RSA.RSAES_OAEP_ENCRYPT(n,e,M,L);       System.out.println("C= "+C);       String clair=RSA.RSAES_OAEP_DECRYPT(n, d, C, L);       System.out.println("Clair= "+clair);       int sLen=21;       String signature=RSA.RSASSA_PSS_SIGN(n, d, M, sLen);       System.out.println("Sign= "+signature);       String VeriySign=RSA.RSASSA_PSS_VERIFY(n, e, M, signature, sLen);       System.out.println(VeriySign);    }}

⌨️ 快捷键说明

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