protected DERObject convertHexEncoded ( String str , int off ) throws IOException { str = str . toLowerCase ( ) ; byte [ ] data = new byte [ str . length ( ) / 2 ] ; for ( int index = 0 ; index != data . length ; index ++ ) { char left = str . charAt ( ( index * 2 ) + off ) ; char right = str . charAt ( ( index * 2 ) + off + 1 ) ; if ( left < ' ' ) { data [ index ] = ( byte ) ( ( left - ' ' ) << 4 ) ; } else { data [ index ] = ( byte ) ( ( left - ' ' + 10 ) << 4 ) ; } if ( right < ' ' ) { data [ index ] |= ( byte ) ( right - ' ' ) ; } else { data [ index ] |= ( byte ) ( right - ' ' + 10 ) ; } } ASN1InputStream aIn = new ASN1InputStream ( new ByteArrayInputStream ( data ) ) ; return aIn . readObject ( ) ; }
Convert an inline encoded hex string rendition of an ASN . 1 object back into its corresponding ASN . 1 object .