code: public Certificate engineGenerateCertificate(InputStream is)
          throws CertificateException
      {
          if (is == null) {
              // clear the caches (for debugging)
              certCache.clear();
              X509CertificatePair.clearCache();
          }
          try {
              byte[] encoding = readOneBlock(is);
              if (encoding != null) {
                  X509CertImpl cert = (X509CertImpl)getFromCache(certCache, encoding);
                  if (cert != null) {
                      return cert;
                  }
                  cert = new X509CertImpl(encoding);
                  addToCache(certCache, cert.getEncodedInternal(), cert);
                  return cert;
              } else {
                  throw new IOException("Empty input");
              }
          } catch (IOException ioe) {
              throw (CertificateException)new CertificateException
              ("Could not parse certificate: " + ioe.toString()).initCause(ioe);
          }
      }
docs: Generates an X.509 certificate object and initializes it with
  the data read from the input stream <code>is</code>.
  
  @param is an input stream with the certificate data.
  
  @return an X.509 certificate object initialized with the data
  from the input stream.
  
  @exception CertificateException on parsing errors.