【问题标题】:Read MAC Iteration from pkcs#12-file in Java从 Java 中的 pkcs#12 文件读取 MAC 迭代
【发布时间】:2018-08-03 11:07:15
【问题描述】:

我的目标是从 pkcs#12 文件中读取 Java 中的 MAC 迭代值,就像 openssl 在 shell 中使用以下命令打印出来一样:

/home/foo> openssl pkcs12 -info -in myPkcs12.pfx -passin pass:myPassword 
MAC Iteration 25000
MAC verified OK
PKCS7 Data
...

【问题讨论】:

    标签: java pkcs#12


    【解决方案1】:

    我设法使用Bouncy Castle(Bouncy Castle + Bouncy Castle Provider)库轻松读取了 MAC 迭代计数。

    final File certFile = ...; 
    final PKCS12PfxPdu pfx = new PKCS12PfxPdu(Files.readAllBytes(certFile.toPath()));
    final Pfx asn1Structure = pfx.toASN1Structure();
    final MacData macData = asn1Structure.getMacData();
    final BigInteger iterationCount = macData.getIterationCount();
    

    【讨论】:

      猜你喜欢
      • 2010-10-07
      • 1970-01-01
      • 2011-07-25
      • 2013-07-03
      • 2012-09-07
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多