生成私钥公钥
在线生成RSA公钥秘钥
秘钥长度:1024
格式:PKCS8
实现算法
package com.shenyue.maventest.BouncyCastleTest;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.crypto.Cipher;
import java.io.IOException;
import java.math.BigInteger;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
public class RsaTest {
private static String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAK7y9iR7QgFKoQ9G\n" +
"Q2y4v5zDLH2wH4jray1Hy2BgyuGU8oQgMQyptkhEVBES7gbL6H/Fm720gILlqA2j\n" +
"3/5Hv1