code: public Set<String> getCriticalExtensionOIDs() {
          if (info == null) {
              return null;
          }
          try {
              CertificateExtensions exts = (CertificateExtensions)info.get(
                                           CertificateExtensions.NAME);
              if (exts == null) {
                  return null;
              }
              Set<String> extSet = new TreeSet<>();
              for (Extension ex : exts.getAllExtensions()) {
                  if (ex.isCritical()) {
                      extSet.add(ex.getExtensionId().toString());
                  }
              }
              return extSet;
          } catch (Exception e) {
              return null;
          }
      }
docs: Gets a Set of the extension(s) marked CRITICAL in the
  certificate. In the returned set, each extension is
  represented by its OID string.
  
  @return a set of the extension oid strings in the
  certificate that are marked critical.