private DerValue readRFC1421Cert(InputStream in) throws IOException {
  DerValue der=null;
  String line=null;
  BufferedReader certBufferedReader=new BufferedReader(new InputStreamReader(in,"ASCII"));
  try {
    line=certBufferedReader.readLine();
  }
 catch (  IOException ioe1) {
    throw new IOException("Unable to read InputStream: " + ioe1.getMessage());
  }
  if (line.equals(X509Factory.BEGIN_CERT)) {
    ByteArrayOutputStream decstream=new ByteArrayOutputStream();
    try {
      while ((line=certBufferedReader.readLine()) != null) {
        if (line.equals(X509Factory.END_CERT)) {
          der=new DerValue(decstream.toByteArray());
          break;
        }
 else {
          decstream.write(Pem.decode(line));
        }
      }
    }
 catch (    IOException ioe2) {
      throw new IOException("Unable to read InputStream: " + ioe2.getMessage());
    }
  }
 else {
    throw new IOException("InputStream is not RFC1421 hex-encoded " + "DER bytes");
  }
  return der;
}

private DerValue readRFC1421Cert ( InputStream in ) throws IOException { DerValue der = null ; String line = null ; BufferedReader certBufferedReader = new BufferedReader ( new InputStreamReader ( in , "ASCII" ) ) ; try { line = certBufferedReader . readLine ( ) ; } catch ( IOException ioe1 ) { throw new IOException ( "Unable to read InputStream: " + ioe1 . getMessage ( ) ) ; } if ( line . equals ( X509Factory . BEGIN_CERT ) ) { ByteArrayOutputStream decstream = new ByteArrayOutputStream ( ) ; try { while ( ( line = certBufferedReader . readLine ( ) ) != null ) { if ( line . equals ( X509Factory . END_CERT ) ) { der = new DerValue ( decstream . toByteArray ( ) ) ; break ; } else { decstream . write ( Pem . decode ( line ) ) ; } } } catch ( IOException ioe2 ) { throw new IOException ( "Unable to read InputStream: " + ioe2 . getMessage ( ) ) ; } } else { throw new IOException ( "InputStream is not RFC1421 hex-encoded " + "DER bytes" ) ; } return der ; }
read input stream as hex - encoded der - encoded bytes
