Not able to read otherName value in Subject Alternativate Names of X509 certificate
<p>I am using bouncycastle java api to read X509 certificate. I need to 
read the values of otherName. </p>

<p>Below is the code snippet that I am using: </p>

<pre><code>private static void getAlternativeName(byte[] extVal) throws CertificateParsingException { 
  try { 
    byte[] extnValue = DEROctetString.getInstance(ASN1Object.fromByteArray(extVal)).getOctets(); 
      Enumeration it = 
DERSequence.getInstance(ASN1Object.fromByteArray(extnValue)).getObjects(); 
      while (it.hasMoreElements()) { 
          GeneralName genName = GeneralName.getInstance(it.nextElement()); 
          switch (genName.getTagNo()) { 
             case GeneralName.otherName : 
                DERObject derObj = genName.getName().getDERObject(); 
                System.out.println("Name -&gt;" + derObj.getClass().getName()); 
                **//Above line is giving org.bouncycastle.asn1.DERSequence class.** 
                System.out.println("In Other Name -&gt; " + 
                genName.getName().getDERObject().toString()); 
                **//Above line is printing [1.3.6.1.4.1.311.20.2.3, [0]ABCDE@GMAIL.COM]** 
               break; 
            default : 
                throw new IOException("Bad tag number: " + genName.getTagNo()); 
            } 
       } 
     } catch (Exception e) { 
         throw new CertificateParsingException(e.getMessage()); 
     } 
} 
</code></pre>

<p><strong>As commented above I want to read the value ABCDE@GMAIL.COM.</strong> 
I tried all possible ways but could not able to do it. </p>

<p>Can someone let me know how can I read the value as a string. </p>

<p>Thanks in advance for your time and help.</p>

<p>Thanks, 
Dheeram </p>
