CertificatePolicies cp = new CertificatePolicies((ASN1Sequence) new DERInputStream( new ByteArrayInputStream(oct.getOctets())).readObject()); String id = cp.getPolicy(0);
ASN1Sequence seq = (ASN1Sequence)new DERInputStream(new ByteArrayInputStream(oct.getOctets())).readObject();  if (seq.size() < pos+1) { return null; } PolicyInformation pol = new PolicyInformation((ASN1Sequence)seq.getObjectAt(pos)); String id = pol.getPolicyIdentifier().getId();
    public static String getCertificatePolicyId(X509Certificate cert)        throws IOException {        byte[] extvalue = cert.getExtensionValue("2.5.29.32");        if (extvalue == null) {            return null;        }        DEROctetString oct = (DEROctetString) (new DERInputStream(new ByteArrayInputStream(extvalue)).readObject());        CertificatePolicies cp = new CertificatePolicies((ASN1Sequence) new DERInputStream(                    new ByteArrayInputStream(oct.getOctets())).readObject());        String id = cp.getPolicy(0);        return id;    } // getCertificatePolicyId