展开全部
package com.tgtbj.dsf.certhelper;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.Date;
import javax.security.auth.x500.X500Principal;
import org.bouncycastle.x509.X509V3CertificateGenerator;
public class TT {
public static void genCertFile(String certPath, String password,
int keysize, String algorithm) throws Exception {
// 创建KeyStore
KeyStore store = KeyStore.getInstance("PKCS12");
store.load(null, null);