Package org.bouncycastle.openpgp

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


    PGPSigner signer = signingConfiguration.getSigner();
    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();
View Full Code Here


            byte[] data = trim(line).getBytes("UTF-8");
           
            armoredOutput.write(data);
            armoredOutput.write(EOL);
           
            signatureGenerator.update(data);
            signatureGenerator.update(EOL);
        }

        armoredOutput.endClearText();
       
View Full Code Here

           
            armoredOutput.write(data);
            armoredOutput.write(EOL);
           
            signatureGenerator.update(data);
            signatureGenerator.update(EOL);
        }

        armoredOutput.endClearText();
       
        PGPSignature signature = signatureGenerator.generate();
View Full Code Here

  private void sign(byte[] body, OutputStream compressedOutput) throws Exception {
    final PGPSignatureGenerator signatureGenerator = getSignatureGenerator(owner.getUnlockedMasterKey());
    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 {
View Full Code Here

            byte[] buffer = new byte[BUFFER_SIZE];
            int bytesRead;
            while ((bytesRead = input.read(buffer)) != -1) {
                litOut.write(buffer, 0, bytesRead);
                if (sigGen != null) {
                    sigGen.update(buffer, 0, bytesRead);
                }
                litOut.flush();
            }
        } finally {
            IOHelper.close(litOut);
View Full Code Here

        {
            do
            {
                lookAhead = readInputLine(lineOut, lookAhead, fIn);

                sGen.update((byte)'\r');
                sGen.update((byte)'\n');

                processLine(aOut, sGen, lineOut.toByteArray());
            }
            while (lookAhead != -1);
View Full Code Here

            do
            {
                lookAhead = readInputLine(lineOut, lookAhead, fIn);

                sGen.update((byte)'\r');
                sGen.update((byte)'\n');

                processLine(aOut, sGen, lineOut.toByteArray());
            }
            while (lookAhead != -1);
        }
View Full Code Here

        FileInputStream          fIn = new FileInputStream(fileName);
        int                      ch = 0;
       
        while ((ch = fIn.read()) >= 0)
        {
            sGen.update((byte)ch);
        }
       
        sGen.generate().encode(bOut);
       
        out.close();
View Full Code Here

        int                         ch = 0;
       
        while ((ch = fIn.read()) >= 0)
        {
            lOut.write(ch);
            sGen.update((byte)ch);
        }
       
        lGen.close();
       
        sGen.generate().encode(bOut);
View Full Code Here

        int ch;
        while ((ch = testIn.read()) >= 0)
        {
            lOut.write(ch);
            sGen.update((byte)ch);
        }
   
        lOut.write(TEST_DATA);
        sGen.update(TEST_DATA);
       
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.