/**
* Java 2 x.509 certificate parser
* Requires Java 2 VM (not Java 1.1)
* Certificate to read can be in:
* (1)X.509/DER binary format or
* (2)X.509/DER BASE64 encoded that:
* starts with -----BEGIN CERTIFICATE-----CR&FL
* ends with -----END CERTIFICATE-----CR&LF
*
* 04/13/99 M. Gallant
*/
import java.security.cert.*;
import java.io.*;
public class J2certinfo
{
public static void main(String [] args) throws FileNotFoundException
{
try
{
InputStream inStream = new FileInputStream( args[0] );
CertificateFactory cf = CertificateFactory.getInstance( "X.509" );
X509Certificate cert = (X509Certificate )cf.generateCertificate( inStream );
inStream.close() ;
out.println(cert.toString( )) ;
}
catch ( CertificateException cex )
{
out.println(cex.toString() );
}
catch ( IOException ioe )
{
out.println( ioe.toString() );
}
}
}