code: public X509Certificate loadCertificate(InputStream in) throws IOException, GeneralSecurityException {
          ASN1InputStream derin = new ASN1InputStream(in);
          ASN1Primitive certInfo = derin.readObject();
          ASN1Sequence seq = ASN1Sequence.getInstance(certInfo);
          return new X509CertificateObject(Certificate.getInstance(seq));
      }
docs: Loads a X509 certificate from the specified input stream. Input stream must contain DER-encoded
  certificate.
  
  @param in
  the input stream to read the certificate from.
  @return <code>X509Certificate</code> the loaded certificate.
  @exception GeneralSecurityException
  if certificate failed to load.