java-pfx文件转换成16进制内容

public static void main(String[] args) throws Exception {
        String path = "D://111.pfx";
        InputStream in = new FileInputStream(new File(path));
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        KeyStore keyStore = KeyStore.getInstance("PKCS12");
        keyStore.load(in,"111".toCharArray());
        keyStore.store(out, "111".toCharArray());
        BASE64Encoder b = new BASE64Encoder();
        System.out.println(b.encode(out.toByteArray()));
    }

这里如果知道pfx里的alias还可以取到私钥和证书。

结果

MIIJIgIBAzCCCNwGCSqGSIb3DQEHAaCCCM0EggjJMIIIxTCCA1IGCSqGSIb3DQEHAaCCA0MEggM/
MIIDOzCCAzcGCyqGSIb3DQEMCgECoIICtjCCArIwHAYKKoZIhvcNAQwBAzAOBAhIpqQrmbCG+QIC
B9AEggKQahOSv1h6dmpTiK61Ja5VRktfTSx5nG4sL/FDck2W501J28w3/wgTClAsQIlJDUhmvGiR
pp+4/H3MV6Pyd150odom0EgwNLhPyCgNDpZZXN79yihTQDTIR9AKivOA8GJousKaeBwxT4Vjs4c2
ZPXtxy11zSffsW+dQ/vWORUjfAvNyBW+MxwSlyNQXC45bfmfnr0VNBqwwf2vvz12zr4hqpiIvAud
/yNlWplghWC0IVWSUId1WMVyj07ZcUTp2P+zGxw/2UJEyYadtt2xSn1SHM4d8gfFpL5oTbL1Nbh1
sTWf00clum7VJkJItgq9S/NaVcsJESm0NeF1Z8p2OmzNQuo4mREkVxLzkh3bE7FXX8HNoMDTGZNZ
nfRK5xs4jEkSsQjZfuYhg+1eeVwCDauF+HA7JhNhsvkByUG6OCGo4vmeKRYEuBxINEY8qrVKS7pE
hfJTYwjuGqHVfQ1bESz9rIwgQK1BxjfFh88JErazDJw2UC6yTU0g0jDflUYMe2MP2rWhynx3Hz9a
0a8/XiEOctytv4Y+crulOE+QJYqT6en7QQSjvi1W5BBMzcLpSfjIhj9yRqidaQT/4aU2yVQbUsOR
RykSnJkGBqznMtrJiHrCORxn9b50MOsj0ksmmrDfpBO5js1n3YzkvoxB0j1W1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P6ml0ZqSU7uxdhUk+ws
KWbo2NRTneM4p12XEoJWIChtAgf57/j9XycZ+5W6lu6x5r6KYIfS4doFZwukV3g9uVe0BNVNqA0w
PTAhMAkGBSsOAwIaBQAEFL97g3fRHDwjgp+OCRMA+jmEiJbSBBSlvNFARIQ1GA0dr2yHu3TzZqPl
7QICBAA=
时间: 2024-11-05 19:37:41

java-pfx文件转换成16进制内容的相关文章

Linux c字符串中不可打印字符转换成16进制

本文由 www.169it.com 搜集整理 如果一个C字符串中同时包含可打印和不可打印的字符,如果想将这个字符串写入文件,同时方便打开文件查看或者在控制台中打印出来不会出现乱码,那么可以将字符串中的不可打印字符转换成16进制,此处提供一个函数供使用: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 void printhex(unsigned char *src,int len) {     

将16进制字符串转换成16进制数据

var tb1 = Tb1.Text; if (string.IsNullOrEmpty(tb1)) { tb1 = "0000"; } var s1 = tb1.Substring(0, 2); var int_1 = Convert.ToInt32(s1, 16); var s2 = tb1.Substring(2, 2); var int_2 = Convert.ToInt32(s2, 16); var bt1 = Convert.ToByte(int_1); var bt2 =

ip地址转换成16进制long

<span style="font-size:18px;">public class IpUtil { /** * ip地址转换成16进制long * @param ipString * @return */ public static Long ipToLong(String ipString) { Long[] ip = new Long[4]; int pos1= ipString.indexOf("."); int pos2= ipString.

C#将文件转成16进制码流写入数据库存起来,访问的时候再还原成PDF文件。

转自https://blog.csdn.net/liubowei_0312/article/details/53378146 适合将文件写入数据库,远程访问的时候还原1.首先把文件转成十六进制文件流 public void FileToStream() { try { IPdfClassBll pdfClassBll = DataFactory.GetPdfClass(); FileStream fs = new FileStream(@"文件路径/***.PDF", FileMode

C#把汉字转换成16进制(HEX)并向串口发送数据

报警器实例:(有发送,无返回获取) 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.IO.Ports; 6 using System.Text.RegularExpressions; 7 using System.Windows.Forms; 8 9 namespace ZKJFJK 10 { 11 /*** 12 报警器语音输

Java中将10进制转换成16进制

import java.util.Scanner; public class Decimal2HexConversion {     public static void main(String[] args){         Scanner input = new Scanner(System.in);         System.out.print("输入一个十进制数: ");         int decimal = input.nextInt();         Sys

object-c将RGB颜色转换成16进制HTML颜色

-(void)color:(NSString *) red andGreen:(NSString*) green andBule:(NSString*) bule{ NSInteger Red = [red integerValue]; NSInteger Green = [green integerValue]; NSInteger Bule = [bule integerValue]; NSInteger colorsize = Red<<16 | Green << 8 | B

本大神教你用PHP把文本内容转换成16进制数字,进行加密

<?php $a="杨波"; $b = bin2hex($a); echo $a."<br />"; $c = pack("H*",$b); echo $c."<br />"; ?> 字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字符限制字

将10进制整数转换成16进制整数输出

题意: 把十进制整数转换为十六进制,格式为0x开头,10~15由大写字母A~F表示. Input 每行一个整数x,0<= x <= 2^31. Output 每行输出对应的八位十六进制整数,包括前导0. 案例输出: Sample Input 0 1023 Sample Output 0x00000000 0x000003FF 注意: 用cin>>输入时无需担心Output Limint Exceeded,而用scanf输入应该加上!=EOF. 代码如下: 1 #include<