title: Using a specific Java security provider only in the scope of a method
body: <p>So I am looking ways to use a security provider only in the scope of a function. I can already do this by adding these two lines: (assume BouncyCastle is the provider)</p>
  
  <pre><code>Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC");
  // do some stuff with converter
  Security.removeProvider("BC");
  </code></pre>
  
  <p>So i just want to use BC for JcaPEMKeyConverter and then for the rest use default security provider.</p>
  
  <p>Is there a better way to do this? More elegantly? How about a custom java annotation, is that a good way ?</p>
  
  <p>Thx :)</p>