title: How do I use BER encoding with object System.DirectoryServices.Protocols.BerConverter.Encode("???", myData)
body: <p>I need to encode and decode BER data.  .NET has the class <code>System.DirectoryServices.Protocols.BerConverter</code></p>
  
  <p>The static method requires me to enter a string in the first parameter as shown below </p>
  
  <pre><code>        byte[] oid = { 0x30, 0xD, 0x6, 0x9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0xD, 0x1, 0x1, 0x1, 0x5, 0x0 }; // Object ID for RSA
  
          var result2 = System.DirectoryServices.Protocols.BerConverter.Decoding("?what goes here?", oid);
  </code></pre>
  
  <p>BER encoding is used in LDAP, Certificates, and is commonplace in many other formats.</p>
  
  <p>I'll be happy with information telling me how to Encode or Decode on this class.  There is nothing on Stack Overflow or the first few pages of Google  (or Bing) regarding this.</p>
  
  <p><strong>Question</strong></p>
  
  <ul>
  <li><p>How do I convert the byte array above to the corresponding OID using BER decoding?</p></li>
  <li><p>How can I parse (or attempt to parse) SubjectPublicKeyInfo ASN.1 data in DER or BER format?</p></li>
  <li><p>It seems the DER encoding\decoding classes are internal to the .NET framework.  If so, where are they?  (I'd like to ask connect.microsoft.com to make these members public)</p></li>
  </ul>