code: public void close() throws IOException, GeneralSecurityException {
          if (mManifest != null) {
              // write the manifest to the jar file
              mOutputJar.putNextEntry(new JarEntry(JarFile.MANIFEST_NAME));
              mManifest.write(mOutputJar);
  
              // CERT.SF
              Signature signature = Signature.getInstance("SHA1with" + mKey.getAlgorithm());
              signature.initSign(mKey);
              mOutputJar.putNextEntry(new JarEntry("META-INF/CERT.SF"));
              SignatureOutputStream out = new SignatureOutputStream(mOutputJar, signature);
              writeSignatureFile(out);
  
              // CERT.*
              mOutputJar.putNextEntry(new JarEntry("META-INF/CERT." + mKey.getAlgorithm()));
              writeSignatureBlock(signature, mCertificate, mKey);
  
              // close out at the end because it can also close mOutputJar.
              // (there's some timing issue here I think, because it's worked before with out
              // being closed after writing CERT.SF).
              out.close();
          }
  
          mOutputJar.close();
          mOutputJar = null;
      }
docs: Closes the Jar archive by creating the manifest, and signing the archive.
  @throws IOException
  @throws GeneralSecurityException