code: public byte[] getExtensionValue(String oid) {
          try {
              ObjectIdentifier findOID = new ObjectIdentifier(oid);
              String extAlias = OIDMap.getName(findOID);
              Extension certExt = null;
              CertificateExtensions exts = (CertificateExtensions)info.get(
                                       CertificateExtensions.NAME);
  
              if (extAlias == null) { // may be unknown
                  // get the extensions, search thru' for this oid
                  if (exts == null) {
                      return null;
                  }
  
                  for (Extension ex : exts.getAllExtensions()) {
                      ObjectIdentifier inCertOID = ex.getExtensionId();
                      if (inCertOID.equals((Object)findOID)) {
                          certExt = ex;
                          break;
                      }
                  }
              } else { // there's sub-class that can handle this extension
                  try {
                      certExt = (Extension)this.get(extAlias);
                  } catch (CertificateException e) {
                      // get() throws an Exception instead of returning null, ignore
                  }
              }
              if (certExt == null) {
                  if (exts != null) {
                      certExt = exts.getUnparseableExtensions().get(oid);
                  }
                  if (certExt == null) {
                      return null;
                  }
              }
              byte[] extData = certExt.getExtensionValue();
              if (extData == null) {
                  return null;
              }
              DerOutputStream out = new DerOutputStream();
              out.putOctetString(extData);
              return out.toByteArray();
          } catch (Exception e) {
              return null;
          }
      }
docs: Gets the DER encoded extension identified by the given
  oid String.
  
  @param oid the Object Identifier value for the extension.