Package org.bouncycastle.openpgp

Examples of org.bouncycastle.openpgp.PGPSignatureGenerator.generate()


    PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(new BcPGPContentSignerBuilder(signer.getSecretKey().getPublicKey().getAlgorithm(), PGPUtil.SHA1));
    signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, signer.getPrivateKey());

    BCPGOutputStream out = new BCPGOutputStream(new ArmoredOutputStream(baos));
    signatureGenerator.update(release);
    signatureGenerator.generate().encode(out);

    out.close();
    baos.close();

    return baos.toByteArray();
View Full Code Here


            signatureGenerator.update(EOL);
        }

        armoredOutput.endClearText();
       
        PGPSignature signature = signatureGenerator.generate();
        signature.encode(new BCPGOutputStream(armoredOutput));
       
        armoredOutput.close();
    }
   
View Full Code Here

    signatureGenerator.generateOnePassVersion(false).encode(compressedOutput);
    final OutputStream literalOutput = getLiteralWrapper(compressedOutput);
    literalOutput.write(body);
    signatureGenerator.update(body);
    literalOutput.close();
    signatureGenerator.generate().encode(compressedOutput);
  }

  private OutputStream getEncryptionWrapper(OutputStream out) throws Exception {

    final PGPEncryptedDataGenerator encryptedDataGenerator = new PGPEncryptedDataGenerator(
View Full Code Here

                litOut.flush();
            }
        } finally {
            IOHelper.close(litOut);
            if (sigGen != null) {
                sigGen.generate().encode(comOut);
            }
            IOHelper.close(comOut, encOut, outputStream, input);
        }
    }
View Full Code Here

        PGPSignatureSubpacketVector packetVector = spGen.generate();
        sGen.setHashedSubpackets(packetVector);

        bOut.flush();

        return PGPPublicKey.addCertification(keyToBeSigned, sGen.generate()).getEncoded();
    }
}
View Full Code Here

       
        aOut.endClearText();
       
        BCPGOutputStream            bOut = new BCPGOutputStream(aOut);
       
        sGen.generate().encode(bOut);

        aOut.close();
    }

    private static void processLine(PGPSignature sig, byte[] line)
View Full Code Here

        while ((ch = fIn.read()) >= 0)
        {
            sGen.update((byte)ch);
        }
       
        sGen.generate().encode(bOut);
       
        out.close();
    }

    public static void main(
View Full Code Here

            sGen.update((byte)ch);
        }
       
        lGen.close();
       
        sGen.generate().encode(bOut);
       
        cGen.close();
       
        out.close();
    }
View Full Code Here

        lOut.write(TEST_DATA);
        sGen.update(TEST_DATA);
       
        lGen.close();
   
        sGen.generate().encode(bOut);
   
        verifySignature(bOut.toByteArray(), hashAlgorithm, pubKey, TEST_DATA);
    }
   
    private void testTextSig(
View Full Code Here

        lOut.write(data);
        sGen.update(data);
       
        lGen.close();
   
        PGPSignature sig = sGen.generate();

        if (sig.getCreationTime().getTime() == 0)
        {
            fail("creation time not set in v4 signature");
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.