国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
pfx keystore 證書互換
import java.io.FileInputStream;  
import java.io.FileOutputStream;  
import java.security.Key;  
import java.security.KeyStore;  
import java.security.cert.Certificate;  
import java.util.Enumeration;  
 
public class ConventPFX {  
    public static final String PKCS12 = "PKCS12";  
    public static final String JKS = "JKS";  
    public static final String PFX_KEYSTORE_FILE = "G:\\test.pfx";  
    public static final String KEYSTORE_PASSWORD = "123456";  
    public static final String JKS_KEYSTORE_FILE = "G:\\test.jks";  
 
    public static void coverTokeyStore() {  
        try {  
            KeyStore inputKeyStore = KeyStore.getInstance("PKCS12");  
            FileInputStream fis = new FileInputStream(PFX_KEYSTORE_FILE);  
            char[] nPassword = null;  
 
            if ((KEYSTORE_PASSWORD == null)  
                    || KEYSTORE_PASSWORD.trim().equals("")) {  
                nPassword = null;  
            } else {  
                nPassword = KEYSTORE_PASSWORD.toCharArray();  
            }  
 
            inputKeyStore.load(fis, nPassword);  
            fis.close();  
 
            KeyStore outputKeyStore = KeyStore.getInstance("JKS");  
 
            outputKeyStore.load(null, KEYSTORE_PASSWORD.toCharArray());  
 
            Enumeration enums = inputKeyStore.aliases();  
 
            while (enums.hasMoreElements()) { //   we   are   readin   just   one   certificate.    
 
                String keyAlias = (String) enums.nextElement();  
 
                System.out.println("alias=[" + keyAlias + "]");  
 
                if (inputKeyStore.isKeyEntry(keyAlias)) {  
                    Key key = inputKeyStore.getKey(keyAlias, nPassword);  
                    Certificate[] certChain = inputKeyStore  
                            .getCertificateChain(keyAlias);  
 
                    outputKeyStore.setKeyEntry(keyAlias, key, KEYSTORE_PASSWORD  
                            .toCharArray(), certChain);  
                }  
            }  
 
            FileOutputStream out = new FileOutputStream(JKS_KEYSTORE_FILE);  
 
            outputKeyStore.store(out, nPassword);  
            out.close();  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
    }  
    public static void coverToPfx() {  
        try {  
            KeyStore inputKeyStore = KeyStore.getInstance("JKS");  
            FileInputStream fis = new FileInputStream(JKS_KEYSTORE_FILE);  
            char[] nPassword = null;  
 
            if ((KEYSTORE_PASSWORD == null)  
                    || KEYSTORE_PASSWORD.trim().equals("")) {  
                nPassword = null;  
            } else {  
                nPassword = KEYSTORE_PASSWORD.toCharArray();  
            }  
 
            inputKeyStore.load(fis, nPassword);  
            fis.close();  
 
            KeyStore outputKeyStore = KeyStore.getInstance("PKCS12");  
 
            outputKeyStore.load(null, KEYSTORE_PASSWORD.toCharArray());  
 
            Enumeration enums = inputKeyStore.aliases();  
 
            while (enums.hasMoreElements()) { //   we   are   readin   just   one   certificate.    
 
                String keyAlias = (String) enums.nextElement();  
 
                System.out.println("alias=[" + keyAlias + "]");  
 
                if (inputKeyStore.isKeyEntry(keyAlias)) {  
                    Key key = inputKeyStore.getKey(keyAlias, nPassword);  
                    Certificate[] certChain = inputKeyStore  
                            .getCertificateChain(keyAlias);  
 
                    outputKeyStore.setKeyEntry(keyAlias, key, KEYSTORE_PASSWORD  
                            .toCharArray(), certChain);  
                }  
            }  
 
            FileOutputStream out = new FileOutputStream(PFX_KEYSTORE_FILE);  
 
            outputKeyStore.store(out, nPassword);  
            out.close();  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
    }  
    public static void main(String[] args) {  
        coverToPfx();  
    }  
}  
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
JAVA如何從一個(gè).p12或.pfx文件中獲取公鑰和私鑰?
從PFX文件中獲取私鑰、公鑰證書、公鑰
Linux openssl 生成證書的詳解
AXIS完全總結(jié)
征服*.PFX(*.p12)——個(gè)人信息交換文件
C#生成Pxf證書
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服