public static Symm obtain ( InputStream is ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { base64url . decode ( is , baos ) ; } catch ( IOException e ) { // don't give clue throw new IOException ( "Invalid Key" ) ; } byte [ ] bkey = baos . toByteArray ( ) ; if ( bkey . length < 0x88 ) { // 2048 bit key throw new IOException ( "Invalid key" ) ; } return baseCrypt ( ) . obtain ( bkey ) ; }
Obtain a Symm from 2048 key from a Stream