public void beginEntry ( JarEntry je , ManifestEntryVerifier mev ) throws IOException { if ( je == null ) return ; if ( debug != null ) { debug . println ( "beginEntry " + je . getName ( ) ) ; } String name = je . getName ( ) ; /* * Assumptions: * 1. The manifest should be the first entry in the META-INF directory. * 2. The .SF/.DSA/.EC files follow the manifest, before any normal entries * 3. Any of the following will throw a SecurityException: * a. digest mismatch between a manifest section and * the SF section. * b. digest mismatch between the actual jar entry and the manifest */ if ( parsingMeta ) { String uname = name . toUpperCase ( Locale . ENGLISH ) ; if ( ( uname . startsWith ( "META-INF/" ) || uname . startsWith ( "/META-INF/" ) ) ) { if ( je . isDirectory ( ) ) { mev . setEntry ( null , je ) ; return ; } if ( SignatureFileVerifier . isBlockOrSF ( uname ) ) { /* We parse only DSA, RSA or EC PKCS7 blocks. */ parsingBlockOrSF = true ; baos . reset ( ) ; mev . setEntry ( null , je ) ; } return ; } } if ( parsingMeta ) { doneWithMeta ( ) ; } if ( je . isDirectory ( ) ) { mev . setEntry ( null , je ) ; return ; } // be liberal in what you accept. If the name starts with ./, remove // it as we internally canonicalize it with out the ./. if ( name . startsWith ( "./" ) ) name = name . substring ( 2 ) ; // be liberal in what you accept. If the name starts with /, remove // it as we internally canonicalize it with out the /. if ( name . startsWith ( "/" ) ) name = name . substring ( 1 ) ; // only set the jev object for entries that have a signature if ( sigFileSigners . get ( name ) != null ) { mev . setEntry ( name , je ) ; return ; } // don't compute the digest for this entry mev . setEntry ( null , je ) ; return ; }
This method scans to see which entry we re parsing and keeps various state information depending on what type of file is being parsed .