Examples of JcePGPDataEncryptorBuilder


Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

                "PGP message is encrypted with a key which could not be found in the Secret Keyring");
    }

    void createEncryptedNonCompressedData(ByteArrayOutputStream bos, String keyringPath) throws Exception, IOException, PGPException,
            UnsupportedEncodingException {
        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(new JcePGPDataEncryptorBuilder(SymmetricKeyAlgorithmTags.CAST5)
                .setSecureRandom(new SecureRandom()).setProvider(getProvider()));
        encGen.addMethod(new JcePublicKeyKeyEncryptionMethodGenerator(readPublicKey(keyringPath)));
        OutputStream encOut = encGen.open(bos, new byte[512]);
        PGPLiteralDataGenerator litData = new PGPLiteralDataGenerator();
        OutputStream litOut = litData.open(encOut, PGPLiteralData.BINARY, PGPLiteralData.CONSOLE, new Date(), new byte[512]);
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

    public void testExceptionDecryptorIncorrectInputFormatSymmetricEncryptedData() throws Exception {

        byte[] payload = "Not Correct Format".getBytes("UTF-8");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();

        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(new JcePGPDataEncryptorBuilder(SymmetricKeyAlgorithmTags.CAST5)
                .setSecureRandom(new SecureRandom()).setProvider(getProvider()));

        encGen.addMethod(new JcePBEKeyEncryptionMethodGenerator("pw".toCharArray()));

        OutputStream encOut = encGen.open(bos, new byte[1024]);
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

      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"));

      final OutputStream encOut = encGen.open(out, compressedData.length);

      encOut.write(compressedData);
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

    public PGPEncryptedDataGenerator(
        int                 encAlgorithm,
        SecureRandom        rand,
        String              provider)
    {
        this(new JcePGPDataEncryptorBuilder(encAlgorithm).setSecureRandom(rand).setProvider(provider));
    }
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

    public PGPEncryptedDataGenerator(
        int                 encAlgorithm,
        SecureRandom        rand,
        Provider            provider)
    {
        this(new JcePGPDataEncryptorBuilder(encAlgorithm).setSecureRandom(rand).setProvider(provider));
    }
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

        int                 encAlgorithm,
        boolean             withIntegrityPacket,
        SecureRandom        rand,
        String              provider)
    {
        this(new JcePGPDataEncryptorBuilder(encAlgorithm).setWithIntegrityPacket(withIntegrityPacket).setSecureRandom(rand).setProvider(provider));
    }
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

        int                 encAlgorithm,
        boolean             withIntegrityPacket,
        SecureRandom        rand,
        Provider            provider)
    {
        this(new JcePGPDataEncryptorBuilder(encAlgorithm).setWithIntegrityPacket(withIntegrityPacket).setSecureRandom(rand).setProvider(provider));
    }
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

        int                 encAlgorithm,
        SecureRandom        rand,
        boolean             oldFormat,
        String              provider)
    {
        this(new JcePGPDataEncryptorBuilder(encAlgorithm).setSecureRandom(rand).setProvider(provider), oldFormat);
    }
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

        int                 encAlgorithm,
        SecureRandom        rand,
        boolean             oldFormat,
        Provider            provider)
    {
        this(new JcePGPDataEncryptorBuilder(encAlgorithm).setSecureRandom(rand).setProvider(provider), oldFormat);
    }
View Full Code Here

Examples of org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder

            out = new ArmoredOutputStream(out);
        }
       
        try
        {   
            PGPEncryptedDataGenerator   cPk = new PGPEncryptedDataGenerator(new JcePGPDataEncryptorBuilder(PGPEncryptedData.CAST5).setWithIntegrityPacket(withIntegrityCheck).setSecureRandom(new SecureRandom()).setProvider("BC"));
               
            cPk.addMethod(new JcePublicKeyKeyEncryptionMethodGenerator(encKey).setProvider("BC"));
           
            OutputStream                cOut = cPk.open(out, new byte[1 << 16]);
           
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.