title: How to get an object identifier for a hash algorithm name in Java
body: <p>I have to perform conversions between cryptography algorithms names and their object identifiers (OIDs). I use Java Cryptography Architecture (JCA) and Bouncy Castle as a security provider. Converting OIDs to textual names is fairly easy with JCA itself.</p>
  
  <pre><code>String oid = "2.16.840.1.101.3.4.2.4";
  MessageDigest md = MessageDigest.getInstance(oid);
  String digestAlgorithmName = md.getAlgorithm();
  </code></pre>
  
  <p>But how do I perform backward conversion from textual names to OIDs? There seems to be no way how to get aliases for algorithm name in JCA. Bouncy Castle 1.50 has maps, which connect algorithm names to OIDs, but all of them have restricted access.</p>