neuhalje / bouncy-gpg

Make using Bouncy Castle with OpenPGP fun again!
https://neuhalje.github.io/bouncy-gpg/
Other
205 stars 58 forks source link

BouncyGPG.registerProvider() method not found #35

Closed cincarnato closed 4 years ago

cincarnato commented 5 years ago

I add bouncy-gpg 2.1.2 as a dependency (Maven).

I follow the examples,, but the method registerProvider in BouncyGPG doesn't exist.

neuhalje commented 5 years ago

Hi @cincarnato ,

it seems I added this after 2.1.2 . Just use the following code:

  /**
   * <p>Register the BouncyCastle provider as first provider. If another instance of the
   * BouncyCastle provider is already registered it is removed.
   * </p>
   * <p>The BouncyCastle provider needs to be registered for BouncyGPG to work.</p>
   * <p>
   * This procedure also makes it possible to use BC on older Android devices that ship their own BC
   * implementation.
   * </p>
   */
  public synchronized static void registerProvider() {
    Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
    Security.insertProviderAt(new BouncyCastleProvider(), 0);
  }