title: java.security.NoSuchAlgorithmException: Signature MD5WITHRSA implementation not found
body: <p>I'm having problems on a Websphere server 8.5
  with
  Java version = 1.6.0, Java Runtime Version = pap6460_26sr8fp7ifx-20151008_01 (SR8 FP7)</p>
  
  <p>The code that fails is:</p>
  
  <pre><code>   Security.addProvider(new BouncyCastleProvider());
     Signature sign = Signature.getInstance("MD5withRSA", "BC");
  </code></pre>
  
  <p>The error I get is: </p>
  
  <pre><code>java.security.NoSuchAlgorithmException: Signature MD5WITHRSA implementation not found: java.lang.ClassNotFoundException: org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$MD5
  </code></pre>
  
  <p>The same code works on a development environment with a slightly different java version (Java version = 1.6.0, Java Runtime Version = pap6460_26sr8fp20-20160111_01 (SR8 FP20))</p>
  
  <p>I have tried listing all signature algorithm with the following code:</p>
  
  <p>Security.addProvider(new BouncyCastleProvider());</p>
  
  <pre><code>    TreeSet&lt;String&gt; algorithms = new TreeSet&lt;String&gt;();
      for (Provider provider : Security.getProviders())
          for (Service service : provider.getServices())
              if (service.getType().equals("Signature"))
                  algorithms.add(service.getAlgorithm());
      for (String algorithm : algorithms)
          System.out.println(algorithm);
  </code></pre>
  
  <p>and I get:</p>
  
  <pre><code>DSA
  DSAforSSL
  ECDSA
  ECDSAforSSL
  ECGOST3410
  GOST3410
  GOST3411WITHECGOST3410
  MD2WITHRSA
  MD2withRSA
  MD4WITHRSA
  MD5WITHRSA
  MD5withRSA
  MD5withRSA/ISO9796-2
  NONEWITHDSA
  NONEwithECDSA
  OID.1.2.840.113549.1.1.10
  RAWRSASSA-PSS
  RIPEMD128WITHRSA
  RIPEMD160WITHECDSA
  RIPEMD160WITHRSA
  RIPEMD160withRSA/ISO9796-2
  RIPEMD256WITHRSA
  RMD128WITHRSA
  RMD160WITHRSA
  RMD256WITHRSA
  RSA
  RSAPSS
  RSASSA-PSS
  RSAforSSL
  SHA1WITHCVC-ECDSA
  SHA1WITHECNR
  SHA1WITHRSA
  SHA1withDSA
  SHA1withECDSA
  SHA1withRSA
  SHA1withRSA/ISO9796-2
  SHA1withRSA/PSS
  SHA224WITHCVC-ECDSA
  SHA224WITHDSA
  SHA224WITHECDSA
  SHA224WITHECNR
  SHA224WITHRSA
  SHA224withECDSA
  SHA224withRSA
  SHA224withRSA/PSS
  SHA256WITHCVC-ECDSA
  SHA256WITHDSA
  SHA256WITHECDSA
  SHA256WITHECNR
  SHA256WITHRSA
  SHA256withDSA
  SHA256withRSA
  SHA256withRSA/PSS
  SHA2withECDSA
  SHA384WITHDSA
  SHA384WITHECDSA
  SHA384WITHECNR
  SHA384WITHRSA
  SHA384withRSA
  SHA384withRSA/PSS
  SHA3withECDSA
  SHA512WITHDSA
  SHA512WITHECDSA
  SHA512WITHECNR
  SHA512WITHRSA
  SHA512withRSA
  SHA512withRSA/PSS
  SHA5withECDSA
  </code></pre>
  
  <p>So, MD5withRSA is there. </p>
  
  <p>Class org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$MD5 is inside the application and</p>
  
  <pre><code> System.out.println("---&gt;DigestSignatureSpi" + MD5.class.getResource("DigestSignatureSpi$MD5.class"));
  </code></pre>
  
  <p>returns the location of the class correctly.</p>
  
  <p>What could be the problem be then?</p>