1.Android 9.0 起,不再支持BC提供者的加密算法

 

Android P(9.0) 证书加密算法变更

例如:

KeyPairGenerator.getInstance("RSA", "BC");

将抛出java.security.NoSuchAlgorithmException:The BC provider no longer provides an implementation for RSA.

 

修改方案: 使用默认RSA ,   KeyPairGenerator.getInstance("RSA");

 

2.生成证书申请的CSR

 

PKCS10CertificationRequest request = new PKCS10CertificationRequest(
      MD5WITHRSA,
      new X509Principal(DN), 
      publicKey, 
      null,
      privateKey,
      null);

抛出异常:java.security.NoSuchAlgorithmException: The BC provider no longer provides an implementation for Signature.MD5withRSA.  Please see https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html for more details.
bc提供者不在提供Signature.MD5withRSA的实现

修改方案:

PKCS10CertificationRequest request = new PKCS10CertificationRequest(
      null,
      new X509Principal(DN), 
      publicKey, 
      null,
      privateKey,
      null);

相关文章:

  • 2021-12-26
  • 2022-12-23
  • 2021-05-23
  • 2021-12-22
  • 2022-01-14
  • 2021-09-16
  • 2021-09-20
猜你喜欢
  • 2021-10-08
  • 2021-04-21
  • 2021-05-30
  • 2022-01-14
  • 2022-01-02
  • 2022-12-23
相关资源
相似解决方案