title: How do I get Java to use my Security provider?
body: <p>I wrote a custom security provider for AES/CBC/PKCS5Padding. That works fine.</p>
  
  <p>What settings do I need to add to the <code>Provider</code> in order for Java to recognize it as a valid provider for the above algorithm? I already have</p>
  
  <pre><code>public class FooBarProvider extends Provider {
    public FooBarProvider() {
      super("FooBar", 1.0, "Provider for AES.");
      put("Cipher.AES", "foo.bar.AESCipher");
    }
  }
  </code></pre>
  
  <p>where the latter argument is the actual <code>CipherSpi</code> that does the work. Where do I register the fact that it supports CBC and PKCS5Padding? Currently asking for a relevant <code>Cipher</code> does not return an instance of my class:</p>
  
  <pre><code>Security.insertProviderAt(new FooBarProvider(), 1);
  Cipher cip = Cipher.getInstance("AES/CBC/PKCS5Padding");
  System.out.println(cip.getProvider()); //prints "SunJCE version 1.7"
  </code></pre>