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 .