Code example for Signature

Methods: sign

  private static void writeSignatureBlock(Signature signature,
      X509Certificate publicKey, OutputStream out) throws IOException,
      GeneralSecurityException { 
    SignerInfo signerInfo = new SignerInfo(new X500Name(publicKey
        .getIssuerX500Principal().getName()), publicKey.getSerialNumber(),
        AlgorithmId.get("SHA1"), AlgorithmId.get("RSA"), signature.sign());
    PKCS7 pkcs7 = new PKCS7(new AlgorithmId[] { AlgorithmId.get("SHA1") },
        new ContentInfo(ContentInfo.DATA_OID, null), 
        new X509Certificate[] { publicKey }, new SignerInfo[] { signerInfo });
  private static void signWholeOutputFile(byte[] zipData,
      OutputStream outputStream, X509Certificate publicKey,
      PrivateKey privateKey) throws IOException, GeneralSecurityException {
    // For a zip with no archive comment, the 
    // end-of-central-directory record will be 22 bytes long, so