/** * */ package at.knowcenter.wag.egov.egiz.test; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.Iterator; import java.util.Set; /** * @author wprinz */ public class X509Ext { /** * @param args * @throws CertificateException * @throws IOException */ public static void main(String[] args) throws CertificateException, IOException { InputStream is = new FileInputStream("C:\\oid.der"); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate(is); is.close(); Set oids = cert.getNonCriticalExtensionOIDs(); Iterator it = oids.iterator(); while (it.hasNext()) { String oid = (String) it.next(); System.out.println(oid); } // Perhaps use IAIK JCE to parse this in a future version. byte [] octet_stream = cert.getExtensionValue("1.2.40.0.10.1.1.1"); System.out.println("octet_stream = " + octet_stream); } }