Package org.bouncycastle.openpgp

Examples of org.bouncycastle.openpgp.PGPPBEEncryptedData


        //
        PGPObjectFactory pgpFact = new PGPObjectFactory(testPBEAsym);

        PGPEncryptedDataList enc = (PGPEncryptedDataList)pgpFact.nextObject();

        PGPPBEEncryptedData     pbe = (PGPPBEEncryptedData)enc.get(1);

        InputStream clear = pbe.getDataStream("password".toCharArray(), "BC");

        pgpFact = new PGPObjectFactory(clear);

        PGPLiteralData          ld = (PGPLiteralData)pgpFact.nextObject();
View Full Code Here


        //
        pgpF = new PGPObjectFactory(encData);

        encList = (PGPEncryptedDataList)pgpF.nextObject();

        PGPPBEEncryptedData encPbe = (PGPPBEEncryptedData)encList.get(1);

        clear = encPbe.getDataStream("password".toCharArray(), "BC");

        pgpF = new PGPObjectFactory(clear);

        checkLiteralData((PGPLiteralData)pgpF.nextObject(), text);
    }
View Full Code Here

        else
        {
            enc = (PGPEncryptedDataList)pgpF.nextObject();
        }

        PGPPBEEncryptedData pbe = (PGPPBEEncryptedData)enc.get(0);

        InputStream clear = pbe.getDataStream(passPhrase, "BC");

        PGPObjectFactory        pgpFact = new PGPObjectFactory(clear);

        PGPCompressedData   cData = (PGPCompressedData)pgpFact.nextObject();
View Full Code Here

        else
        {
            enc = (PGPEncryptedDataList)pgpF.nextObject();
        }

        PGPPBEEncryptedData     pbe = (PGPPBEEncryptedData)enc.get(0);

        InputStream clear = pbe.getDataStream(passPhrase, "BC");
       
        PGPObjectFactory        pgpFact = new PGPObjectFactory(clear);

        //
        // if we're trying to read a file generated by someone other than us
        // the data might not be compressed, so we check the return type from
        // the factory and behave accordingly.
        //
        o = pgpFact.nextObject();
        if (o instanceof PGPCompressedData)
        {
            PGPCompressedData   cData = (PGPCompressedData)o;

            pgpFact = new PGPObjectFactory(cData.getDataStream());

            o = pgpFact.nextObject();
        }
       
        PGPLiteralData          ld = (PGPLiteralData)o;
       
        FileOutputStream        fOut = new FileOutputStream(ld.getFileName());
       
        InputStream    unc = ld.getInputStream();
        int    ch;
       
        while ((ch = unc.read()) >= 0)
        {
            fOut.write(ch);
        }
       
        if (pbe.isIntegrityProtected())
        {
            if (!pbe.verify())
            {
                System.err.println("message failed integrity check");
            }
            else
            {
View Full Code Here

   
    private static class DecryptWorker {
       
        public byte[] goToWork(byte[] encrypted, char[] passPhrase) throws IOException, CryptoException {
            try {
                PGPPBEEncryptedData pbe = extractEncryptedData(encrypted);
                PGPLiteralData ld = extractLiteralData(pbe, passPhrase);
                return decryptLiteralData(ld);
            } catch (NoSuchProviderException ex) {
                throw new CryptoException(ex.getMessage(), ex);
            } catch (PGPException ex) {
View Full Code Here

        //
        pgpF = new PGPObjectFactory(encData);

        encList = (PGPEncryptedDataList)pgpF.nextObject();

        PGPPBEEncryptedData encPbe = (PGPPBEEncryptedData)encList.get(1);

        clear = encPbe.getDataStream("password".toCharArray(), "BC");

        pgpF = new PGPObjectFactory(clear);

        checkLiteralData((PGPLiteralData)pgpF.nextObject(), text);
    }
View Full Code Here

            enc = (PGPEncryptedDataList)o;
        }else{
            enc = (PGPEncryptedDataList)pgpF.nextObject();
        }

        PGPPBEEncryptedData pbe = (PGPPBEEncryptedData)enc.get(0);
        InputStream clear = pbe.getDataStream(passPhrase, "BC");
        PGPObjectFactory        pgpFact = new PGPObjectFactory(clear);
        PGPCompressedData   cData = (PGPCompressedData)pgpFact.nextObject();
        pgpFact = new PGPObjectFactory(cData.getDataStream());
        PGPLiteralData  ld = (PGPLiteralData)pgpFact.nextObject();
        InputStream unc = ld.getInputStream();
View Full Code Here

TOP

Related Classes of org.bouncycastle.openpgp.PGPPBEEncryptedData

Copyright © 2018 www.massapicom. 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.