- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想解密 Java JCEKS keystore 中的私钥,但我不想使用 Java。
我可以找到 PBEWithMD5AndTripleDES 的描述,但找不到实际的实现。
此评论据称解释了推导过程:
/**
* This class implements a proprietary password-based encryption algorithm.
* It is based on password-based encryption as defined by the PKCS #5
* standard, except that is uses triple DES instead of DES.
*
* Here's how this algorithm works:
*
* 1. Create random salt and split it in two halves. If the two halves are
* identical, invert one of them.
* 2. Concatenate password with each of the halves.
* 3. Digest each concatenation with c iterations, where c is the
* iterationCount. Concatenate the output from each digest round with the
* password, and use the result as the input to the next digest operation.
* The digest algorithm is MD5.
* 4. After c iterations, use the 2 resulting digests as follows:
* The 16 bytes of the first digest and the 1st 8 bytes of the 2nd digest
* form the triple DES key, and the last 8 bytes of the 2nd digest form the
* IV.
*
* @author Jan Luehe
* @see javax.crypto.Cipher
*/
但是,第一个串联是密码 + half-of-salt
,还是half-of-salt + 密码
?后面几轮的输入是密码+摘要
,还是摘要+密码
。
在 8 位字符或完整的 16 位字符以及可能的串联组合之间,您可能会认为通过反复试验我现在应该已经解决了。
我知道盐、迭代和密码,甚至是密文应该解密的明文(即我有解密的数据)。
派生 24 字节 DES3 key (无论是修复奇偶校验还是不管它)和 8 字节 IV,在 DES3 CBC 模式下解密,我都无法重新创建我的明文。
此评论描述的算法是什么?
最佳答案
感谢回复评论的 erikson 1 on this answer另一个问题,以及 Ebbe M. Pedersen。最后,我应该在尝试不同的组合时被答案绊倒,但不知何故错过了。
对于感兴趣的人,一旦您打开 JKS 并找到条目,加密的 PKCS#8 将显示 JCEKS 算法 1.3.6.1.4.1.42.2.19.1 以及盐和迭代计数参数以及这些参数和您的 8-位/字符密码,您可以解密密文以找到保存您私钥的内部未加密 PKCS#8。
def jce_pbkdf1(password, salt, iterations)
salts = [copy = salt.dup, copy.slice!((copy.length / 2)..-1)]
octets = salts.map { |half| (iterations).times.inject(half) { |digest| OpenSSL::Digest.digest('md5', digest + password) } }.join
return octets[0..23], octets[24..-1] // key (parity not set) and IV
end
关于java - JCEKS PBE 用于加密私钥的算法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35610017/
我正在尝试使用 Java AES 算法加密一些数据库列(字符串值)。这是为了保护某些敏感数据。对于某些用户,这些数据应该解密。 在 Java AES 加密中,如果我的输入字符长度为 60,我得到的加密
我尝试使用 ouath2 和生成的 .p12 key 通过 google api 进行身份验证时遇到问题。 问题是,当 google credential api 尝试设置 .p12 key 时,它会
我有一个 PBE 生成的 key ,并且使用算法“PBEWithHmacSHA256AndAES_128”对一个字符串进行了加密,但是我无法破译该字符串。 key 生成: private final
我想解密 Java JCEKS keystore 中的私钥,但我不想使用 Java。 我可以找到 PBEWithMD5AndTripleDES 的描述,但找不到实际的实现。 此评论据称解释了推导过程:
Cipher 和/或 PBEKeySpec 似乎存在线程安全问题。 JDK:1.8.0_102、1.8.0_151 和 9.0.1+11 PBKDF2算法:PBKDF2WithHmacSHA1 密码算
我正在尝试测试 PBE 加密/解密。我发现 PBE 使用不同的盐和迭代次数生成相同的 key 。当然,使用的密码是一样的。 据我了解,相同的密码和不同的盐/迭代应该得到不同的 key 。 下面是我的测
在 Java 中,我看到每种加密类型都有最大 key 大小,例如 AES-256、DES-128、3DES-128 等。在 PBE 中,我们输入 key 并通过盐对其进行修改。我想知道 PBE 的最大
我想用Java写一个基于密码的加解密! 这意味着我有一个 K(密码) 和 P(纯文本) 并创建这样一个 E(加密文本)然后我可以用我的第一个 K 解密那个 E。 正如我在 StackOverflow
我正在用 Java 开发一个应用程序,我希望允许用户使用他们选择的密码来加密文件(或文件夹 - 我会压缩目录)。我目前有以下方法: static Cipher createCipher(int mod
我想使用 PBE 加密我的数据。到目前为止,我已经编写了以下代码: moteurCryptage = Cipher.getInstance("PBEWithMD5AndDES");
在阅读了几个关于实现 AES 的 stackoverflow 问题后,我想我开始理解基础知识了: 每次我都应该生成一个新的 IV 使用 PBE 时,迭代次数应在 1000-4000+ 左右 因为我无法
我正在试验 key 派生函数,我注意到我通过所有 PBE 算法生成的 key 编码为纯文本密码。 我的意思是: public class Main { public static void m
除了 DES、3DES 和 AES 加密技术外,我还实现了 PBE。我需要 PBE 优于其他三个的一些优势。当我在互联网上搜索时,我只发现了缺点。帮我弄清楚使用 PBE 的一些优势? 最佳答案 如果我
使用 Bouncy CaSTLe PBEWITHSHA256AND128BITAES-CBC-BC 算法对 Java 中的字符串数据进行加密。很难用 ruby 解密它。我见过一些类似操作的示例,但没有
我正在尝试使用 AES 通过 PBE 加密/解密文件。我正在使用 Bouncy Casle 库(轻量级 API),因为我需要忽略 key 长度的限制。我找到了函数并更改了其中的一些代码。 public
我使用 PBE AES_256 将一些文本加密并存储在数据库中。这最初是使用 java 1.8.0_65 完成的。升级到最新的 java 后,我无法再解密这些字段。我已指出与 1.8.0_71 的不兼
我有一个使用 JCE 算法“PBEWithSHA256And256BitAES-CBC-BC”创建的密文 block 。提供者是 BouncyCaSTLe。我想做的是使用 BouncyCaSTLe 轻
我正在使用以下代码 fragment 获取指定算法的工厂实例。但它会抛出 java.security.NoSuchAlgorithmException。我在 jre1.6 的 java 项目中使用它。
我正在尝试通过 TLS 端口从运行 maven spring-boot 应用程序客户端的 docker 容器连接到 RabbitMQ 实例。 虽然我已经更新了 java.security 与行: se
我是一名优秀的程序员,十分优秀!