public static PublicKey parse(DerValue in) throws IOException
    {
        AlgorithmId     algorithm;
        PublicKey       subjectKey;

        if (in.tag != DerValue.tag_Sequence)
            throw new IOException("corrupt subject key");

        algorithm = AlgorithmId.parse(in.data.getDerValue());
        try {
            subjectKey = buildX509Key(algorithm,
                                      in.data.getUnalignedBitString());

        } catch (InvalidKeyException e) {
            throw new IOException("subject key, " + e.getMessage(), e);
        }

        if (in.data.available() != 0)
            throw new IOException("excess subject key");
        return subjectKey;
    }
public static PublicKey parse ( DerValue in ) throws IOException { AlgorithmId algorithm ; PublicKey subjectKey ; if ( in . tag != DerValue . tag_Sequence ) throw new IOException ( "corrupt subject key" ) ; algorithm = AlgorithmId . parse ( in . data . getDerValue ( ) ) ; try { subjectKey = buildX509Key ( algorithm , in . data . getUnalignedBitString ( ) ) ; } catch ( InvalidKeyException e ) { throw new IOException ( "subject key, " + e . getMessage ( ) , e ) ; } if ( in . data . available ( ) != 0 ) throw new IOException ( "excess subject key" ) ; return subjectKey ; }
Construct X.509 subject public key from a DER value.  If
the runtime environment is configured with a specific class for
this kind of key, a subclass is returned.  Otherwise, a generic
X509Key object is returned.

<P>This mechanism gurantees that keys (and algorithms) may be
freely manipulated and transferred, without risk of losing
information.  Also, when a key (or algorithm) needs some special
handling, that specific need can be accomodated.

@param in the DER-encoded SubjectPublicKeyInfo value
@exception IOException on data format errors