1

从此代码段:

try {
    EncryptionUtils smimeUtils = EncryptionManager.getEncryptionUtils(EncryptionManager.SMIME);
    char[] smimePw = new String("hello world").toCharArray();
    EncryptionKeyManager smimeKeyMgr = smimeUtils.createKeyManager();
    smimeKeyMgr.loadPrivateKeystore(privateKeyStore, smimePw);

   } catch (NoSuchProviderException e) {
            Log.e("NoSuchProvider: ", e.getMessage());
   } catch (CertificateException e) {
            Log.e("Certificate: ", e.getMessage());
   } catch (KeyStoreException e) {
            Log.e("KeyStore: ", e.getMessage()); 
   } catch (NoSuchAlgorithmException e) {
            Log.e("No Such Algorithm: ", e.getMessage()); 
   } catch (IOException e) {
            Log.e("IO: ", e.getMessage());
   }

我尝试加载S/MIME加密管理器,但这段代码会NoSuchProviderException告诉我:

No provider configured for S/MIME

我正在关注指南,它告诉我添加以下内容.jar-files

  1. javamail-crypto.jar
  2. bcprov-jdk14-122.jar
  3. bcmail-jdk14-122.jar

我找不到带有结尾的确切版本,但我在构建路径中-122包含了以下内容:jar-files

  1. bcprov-jdk14-147
  2. bcmail-jdk14-147
  3. javamail-crypto
  4. javamail-crypto-bouncycastle-smime

但它仍然抛出exception,任何人都可以给我一个关于如何解决这个问题的提示吗?

4

0 回答 0