code: public Extension getExtension(ObjectIdentifier oid) {
          if (info == null) {
              return null;
          }
          try {
              CertificateExtensions extensions;
              try {
                  extensions = (CertificateExtensions)info.get(CertificateExtensions.NAME);
              } catch (CertificateException ce) {
                  return null;
              }
              if (extensions == null) {
                  return null;
              } else {
                  Extension ex = extensions.getExtension(oid.toString());
                  if (ex != null) {
                      return ex;
                  }
                  for (Extension ex2: extensions.getAllExtensions()) {
                      if (ex2.getExtensionId().equals((Object)oid)) {
                          //XXXX May want to consider cloning this
                          return ex2;
                      }
                  }
                  /* no such extension in this certificate */
                  return null;
              }
          } catch (IOException ioe) {
              return null;
          }
      }
docs: Gets the extension identified by the given ObjectIdentifier
  
  @param oid the Object Identifier value for the extension.
  @return Extension or null if certificate does not contain this
  extension