code: public static List<String> getExtendedKeyUsage(X509Certificate cert)
          throws CertificateParsingException {
          try {
              byte[] ext = cert.getExtensionValue(EXTENDED_KEY_USAGE_OID);
              if (ext == null)
                  return null;
              DerValue val = new DerValue(ext);
              byte[] data = val.getOctetString();
  
              ExtendedKeyUsageExtension ekuExt =
                  new ExtendedKeyUsageExtension(Boolean.FALSE, data);
              return Collections.unmodifiableList(ekuExt.getExtendedKeyUsage());
          } catch (IOException ioe) {
              throw new CertificateParsingException(ioe);
          }
      }
docs: This static method is the default implementation of the
  getExtendedKeyUsage method in X509Certificate. A
  X509Certificate provider generally should overwrite this to
  provide among other things caching for better performance.