Package org.bouncycastle.openpgp

Examples of org.bouncycastle.openpgp.PGPEncryptedDataGenerator.addMethod()


        comOut.close();

        cbOut = new ByteArrayOutputStream();
        cPk = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, rand, "BC");
       
        cPk.addMethod(pass);
       
        cOut = cPk.open(new UncloseableOutputStream(cbOut), new byte[16]);

        cOut.write(bOut.toByteArray());
View Full Code Here


        // with integrity packet
        //
        cbOut = new ByteArrayOutputStream();
        cPk = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, true, rand, "BC");
       
        cPk.addMethod(pass);
       
        cOut = cPk.open(new UncloseableOutputStream(cbOut), new byte[16]);

        cOut.write(bOut.toByteArray());
View Full Code Here

        comOut.close();
       
        cbOut = new ByteArrayOutputStream();
        cPk = new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, true, rand, "BC");

        cPk.addMethod(pass);

        cOut = cPk.open(new UncloseableOutputStream(cbOut), new byte[16]);

        cOut.write(bOut.toByteArray());
View Full Code Here

            //
            ByteArrayOutputStream        cbOut = new ByteArrayOutputStream();
            PGPEncryptedDataGenerator    cPk = new PGPEncryptedDataGenerator(new BcPGPDataEncryptorBuilder(SymmetricKeyAlgorithmTags.TRIPLE_DES).setSecureRandom(new SecureRandom()));
            PGPPublicKey                        puK = sKey.getSecretKey(pgpKeyID).getPublicKey();
           
            cPk.addMethod(new BcPublicKeyKeyEncryptionMethodGenerator(puK));
           
            OutputStream    cOut = cPk.open(new UncloseableOutputStream(cbOut), bOut.toByteArray().length);

            cOut.write(text);
View Full Code Here

                cPk = new PGPEncryptedDataGenerator(new BcPGPDataEncryptorBuilder(SymmetricKeyAlgorithmTags.CAST5).setSecureRandom(random));

                puK = elGamalKeyPair.getPublicKey();

                cPk.addMethod(new BcPublicKeyKeyEncryptionMethodGenerator(puK));

                cbOut = new ByteArrayOutputStream();

                cOut = cPk.open(cbOut, text.length);
View Full Code Here

        ByteArrayOutputStream bcOut = new ByteArrayOutputStream();

        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(SymmetricKeyAlgorithmTags.AES_128, true, new SecureRandom(), "BC");

        encGen.addMethod(pgpPubKey);

        encGen.addMethod("password".toCharArray());

        OutputStream cOut = encGen.open(bcOut, bytes.length);
View Full Code Here

        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(SymmetricKeyAlgorithmTags.AES_128, true, new SecureRandom(), "BC");

        encGen.addMethod(pgpPubKey);

        encGen.addMethod("password".toCharArray());

        OutputStream cOut = encGen.open(bcOut, bytes.length);

        cOut.write(bytes);
View Full Code Here

   
        ByteArrayOutputStream        cbOut = new ByteArrayOutputStream();
        PGPEncryptedDataGenerator    cPk = new PGPEncryptedDataGenerator(SymmetricKeyAlgorithmTags.CAST5, new SecureRandom(), "BC");           
        PGPPublicKey                 puK = pgpPriv.getSecretKey(encP.getKeyID()).getPublicKey();
       
        cPk.addMethod(puK);
       
        OutputStream    cOut = cPk.open(new UncloseableOutputStream(cbOut), shortText.length);

        cOut.write(shortText);
View Full Code Here

        //
        cbOut = new ByteArrayOutputStream();
        cPk = new PGPEncryptedDataGenerator(SymmetricKeyAlgorithmTags.CAST5, new SecureRandom(), "BC");           
        puK = pgpPriv.getSecretKey(encP.getKeyID()).getPublicKey();
       
        cPk.addMethod(puK);

        cOut = cPk.open(new UncloseableOutputStream(cbOut), text.length);

        cOut.write(text);
View Full Code Here

      SymmetricAlgorithm.DEFAULT.toInteger(), true, random,
      "BC");

    for (KeySet recipient : recipients) {
      if (recipient.getSubKey().getKeyID() != owner.getSubKey().getKeyID()) {
        encryptedDataGenerator.addMethod(recipient.getSubKey().getPublicKey());
      }
    }

    encryptedDataGenerator.addMethod(owner.getSubKey().getPublicKey());
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.