import org.spongycastle.jce.provider.BouncyCastleProvider;
Security.addProvider(new BouncyCastleProvider());
KeyFactory factory = KeyFactory.getInstance("ESDSA", "BC");
publicKeyServer = (ECPublicKey) factory.generatePublic(new X509EncodedKeySpec(bytePubKeyServer));
这是我尝试添加 bounycastleProvider 的代码。 bouncycastle Jar 在 Android 上不起作用,所以我看到我需要使用海绵城堡罐。所以我添加了海绵城堡罐,现在我卡住了。 在这段代码中,我尝试将字节转换为公钥。
这是错误信息
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/spongycastle/util/Strings
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
implementation 'com.madgag.spongycastle:bctls-jdk15on:1.58.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}