public static Object parse(final PemObject obj) throws GeneralSecurityException
	{
		if (obj == null)
		{
			return null;
		}
		else if (obj.getType() == null)
		{
			throw new RuntimeException("Encountered invalid PemObject with null type: " + obj);
		}
		else if (obj.getType().equalsIgnoreCase("CERTIFICATE") || obj.getType().equalsIgnoreCase("X.509 CERTIFICATE"))
		{
			return parseX509Certificate(obj);
		}
		else
		{
			throw new IllegalArgumentException("Unknown PEM contents: encountered unsupported entry of type " +
			                                   obj.getType() +
			                                   " (expected CERTIFICATE or X.509 CERTIFICATE)");
		}
	}
public static Object parse ( final PemObject obj ) throws GeneralSecurityException { if ( obj == null ) { return null ; } else if ( obj . getType ( ) == null ) { throw new RuntimeException ( "Encountered invalid PemObject with null type: " + obj ) ; } else if ( obj . getType ( ) . equalsIgnoreCase ( "CERTIFICATE" ) || obj . getType ( ) . equalsIgnoreCase ( "X.509 CERTIFICATE" ) ) { return parseX509Certificate ( obj ) ; } else { throw new IllegalArgumentException ( "Unknown PEM contents: encountered unsupported entry of type " + obj . getType ( ) + " (expected CERTIFICATE or X.509 CERTIFICATE)" ) ; } }
Parse a PemObject. Currently only supports  <code>CERTIFICATE</code> / <code>X.509 CERTIFICATE</code> types

@param obj
a PemObject with a type and with contents

@return a parsed object (or null if the input is null)

@throws GeneralSecurityException
if there is a parsing problem
@throws IllegalArgumentException
if the PemObject cannot be recognised