Examples of ArmoredOutputStream


Examples of org.bouncycastle.bcpg.ArmoredOutputStream

        ByteArrayOutputStream    encOut = new ByteArrayOutputStream();
       
        OutputStream out = encOut;
        if (armor)
        {
            out = new ArmoredOutputStream(out);
        }

        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();

View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

            spGen.setSignerUserID(false, (String)it.next());
            sGen.setHashedSubpackets(spGen.generate());
        }
       
        FileInputStream        fIn = new FileInputStream(fileName);
        ArmoredOutputStream    aOut = new ArmoredOutputStream(out);
       
        aOut.beginClearText(digest);

        //
        // note the last \n/\r/\r\n in the file is ignored
        //
        ByteArrayOutputStream lineOut = new ByteArrayOutputStream();
        int lookAhead = readInputLine(lineOut, fIn);

        processLine(aOut, sGen, lineOut.toByteArray());

        if (lookAhead != -1)
        {
            do
            {
                lookAhead = readInputLine(lineOut, lookAhead, fIn);

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

                processLine(aOut, sGen, lineOut.toByteArray());
            }
            while (lookAhead != -1);
        }
       
        aOut.endClearText();
       
        BCPGOutputStream            bOut = new BCPGOutputStream(aOut);
       
        sGen.generate().encode(bOut);

        aOut.close();
    }
View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

    final PGPEncryptedDataGenerator cpk =
        new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, true, prng, "BC");
    cpk.addMethod(dest);

    final ByteArrayOutputStream buf = new ByteArrayOutputStream();
    final ArmoredOutputStream aout = new ArmoredOutputStream(buf);
    final OutputStream cout = cpk.open(aout, zText.length);
    cout.write(zText);
    cout.close();
    aout.close();

    return buf.toByteArray();
  }
View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

            IOUtils.closeQuietly(plaintextStream);
        }
        byte[] compressedData = PGPDataFormatUtil.compress(plaintextData, PGPLiteralData.CONSOLE, CompressionAlgorithmTags.ZIP);

        if (armored) {
            outputStream = new ArmoredOutputStream(outputStream);
        }

        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, integrity, new SecureRandom(), "BC");
        encGen.addMethod(key);
View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

        byte[] compressedData = PGPDataFormatUtil.compress(IOUtils.toByteArray(plaintextStream),
                PGPLiteralData.CONSOLE, CompressionAlgorithmTags.ZIP);

        if (armored) {
            outputStream = new ArmoredOutputStream(outputStream);
        }

        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, integrity, new SecureRandom(), "BC");
        encGen.addMethod(key);
View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

        exchange.getOut().setHeader(NUMBER_OF_ENCRYPTION_KEYS, Integer.valueOf(keys.size()));

        InputStream input = ExchangeHelper.convertToMandatoryType(exchange, InputStream.class, graph);

        if (armored) {
            outputStream = new ArmoredOutputStream(outputStream);
        }

        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(new JcePGPDataEncryptorBuilder(findAlgorithm(exchange))
                .setWithIntegrityPacket(integrity).setSecureRandom(new SecureRandom()).setProvider(getProvider()));
        // several keys can be added
View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

        exchange.getOut().setHeader(NUMBER_OF_ENCRYPTION_KEYS, Integer.valueOf(keys.size()));

        InputStream input = ExchangeHelper.convertToMandatoryType(exchange, InputStream.class, graph);

        if (armored) {
            outputStream = new ArmoredOutputStream(outputStream);
        }

        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(new JcePGPDataEncryptorBuilder(findAlgorithm(exchange))
                .setWithIntegrityPacket(integrity).setSecureRandom(new SecureRandom()).setProvider(getProvider()));
        // several keys can be added
View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

        byte[] compressedData = PGPDataFormatUtil.compress(IOUtils.toByteArray(plaintextStream),
                PGPLiteralData.CONSOLE, CompressionAlgorithmTags.ZIP);

        if (armored) {
            outputStream = new ArmoredOutputStream(outputStream);
        }

        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, integrity, new SecureRandom(), "BC");
        encGen.addMethod(key);
View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

     * {@inheritDoc}
     */
    @Override
    public void initialize(OutputStream out) throws Exception
    {
        armoredOut = new ArmoredOutputStream(out);
        PGPEncryptedDataGenerator encrDataGen = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, false,
            new SecureRandom(), provider);
        encrDataGen.addMethod(this.publicKey);
        encryptedOutputStream = encrDataGen.open(armoredOut, new byte[1 << 16]);

View Full Code Here

Examples of org.bouncycastle.bcpg.ArmoredOutputStream

    try {

      final byte[] compressedData = compress(data, name, CompressionAlgorithmTags.ZIP);

      if (armor) {
        out = new ArmoredOutputStream(out);
      }

      final PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(new JcePGPDataEncryptorBuilder(algorithm).setSecureRandom(new SecureRandom()).setProvider("BC"));
      encGen.addMethod(new JcePBEKeyEncryptionMethodGenerator(passphrase.toCharArray()).setProvider("BC"));
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.