"NoSuchFieldError: qTESLA_I" with JcaContentSignerBuilder
"NoSuchFieldError: qTESLA_I" with JcaContentSignerBuilder
最基本的例子:
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
public class NoSuchFieldDemo {
public static void main(String[] args) {
JcaContentSignerBuilder builder = new JcaContentSignerBuilder("SHA384withECDSA");
}
}
投掷:
Exception in thread "main" java.lang.NoSuchFieldError: qTESLA_I
at org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder.(Unknown Source)
at org.bouncycastle.operator.jcajce.JcaContentSignerBuilder.(Unknown Source)
at NoSuchFieldDemo.main(NoSuchFieldDemo.java:5)
PS #1:代码,包括有点 "magic" 的字符串 "SHA384withECDSA"
,来自 "The Bouncy Castle FIPS Java API in 100 Examples".
PS #2:添加 BouncyCastleFipsProvider
作为首选安全提供程序后,这种情况仍然存在:
// position is 1-based:
final int mostPreferredPosition = 1;
final int actualPosition = Security.insertProviderAt(new BouncyCastleFipsProvider(), mostPreferredPosition);
PS #3:我在 Ubuntu 18.04 上使用 AdoptOpenJDK 11.0.3+7 以防万一
我想这是最明显的,但我做错了什么?
更新
为了 JcaContentSignerBuilder
,我在类路径中添加了 bcpkix-jdk15on
。 @george-stanchev 建议这可能会干扰..?
确保您的类路径中没有非 FIPS jar。如果您使用非 FIPS bcpkix 和 FIPS bcprov,就会发生这种情况。非 FIPS bcpkix 静态尝试添加那些在 bcprov 中定义的 qTESLA 算法,但 FIPS bcprov 没有定义这些算法,因此例外。
最基本的例子:
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
public class NoSuchFieldDemo {
public static void main(String[] args) {
JcaContentSignerBuilder builder = new JcaContentSignerBuilder("SHA384withECDSA");
}
}
投掷:
Exception in thread "main" java.lang.NoSuchFieldError: qTESLA_I
at org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder.(Unknown Source)
at org.bouncycastle.operator.jcajce.JcaContentSignerBuilder.(Unknown Source)
at NoSuchFieldDemo.main(NoSuchFieldDemo.java:5)
PS #1:代码,包括有点 "magic" 的字符串 "SHA384withECDSA"
,来自 "The Bouncy Castle FIPS Java API in 100 Examples".
PS #2:添加 BouncyCastleFipsProvider
作为首选安全提供程序后,这种情况仍然存在:
// position is 1-based:
final int mostPreferredPosition = 1;
final int actualPosition = Security.insertProviderAt(new BouncyCastleFipsProvider(), mostPreferredPosition);
PS #3:我在 Ubuntu 18.04 上使用 AdoptOpenJDK 11.0.3+7 以防万一
我想这是最明显的,但我做错了什么?
更新
为了 JcaContentSignerBuilder
,我在类路径中添加了 bcpkix-jdk15on
。 @george-stanchev 建议这可能会干扰..?
确保您的类路径中没有非 FIPS jar。如果您使用非 FIPS bcpkix 和 FIPS bcprov,就会发生这种情况。非 FIPS bcpkix 静态尝试添加那些在 bcprov 中定义的 qTESLA 算法,但 FIPS bcprov 没有定义这些算法,因此例外。