Examples of nextObject()


Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

        try {
            in = PGPUtil.getDecoderStream(encryptedStream);
            encData = getDecryptedData(exchange, in);
            uncompressedData = getUncompressedData(encData);
            PGPObjectFactory pgpFactory = new PGPObjectFactory(uncompressedData);
            Object object = pgpFactory.nextObject();

            PGPOnePassSignature signature;
            if (object instanceof PGPOnePassSignatureList) {
                signature = getSignature(exchange, (PGPOnePassSignatureList) object);
                object = pgpFactory.nextObject();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

            Object object = pgpFactory.nextObject();

            PGPOnePassSignature signature;
            if (object instanceof PGPOnePassSignatureList) {
                signature = getSignature(exchange, (PGPOnePassSignatureList) object);
                object = pgpFactory.nextObject();
            } else {
                // no signature contained in PGP message
                signature = null;
                if (SIGNATURE_VERIFICATION_OPTION_REQUIRED.equals(getSignatureVerificationOption())) {
                    throw new PGPException(
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

        }
    }

    private InputStream getUncompressedData(InputStream encData) throws IOException, PGPException {
        PGPObjectFactory pgpFactory = new PGPObjectFactory(encData);
        Object compObj = pgpFactory.nextObject();
        if (!(compObj instanceof PGPCompressedData)) {
            throw getFormatException();
        }
        PGPCompressedData comData = (PGPCompressedData) compObj;
        InputStream uncompressedData = comData.getDataStream();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

        return uncompressedData;
    }

    private InputStream getDecryptedData(Exchange exchange, InputStream encryptedStream) throws Exception, PGPException {
        PGPObjectFactory pgpFactory = new PGPObjectFactory(encryptedStream);
        Object firstObject = pgpFactory.nextObject();
        // the first object might be a PGP marker packet
        PGPEncryptedDataList enc = getEcryptedDataList(pgpFactory, firstObject);

        if (enc == null) {
            throw getFormatException();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

    public static PGPPrivateKey findPrivateKey(CamelContext context, InputStream keyringInput, InputStream encryptedInput, String passphrase) throws IOException,
            PGPException, NoSuchProviderException {
        PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyringInput));
        PGPObjectFactory factory = new PGPObjectFactory(PGPUtil.getDecoderStream(encryptedInput));
        PGPEncryptedDataList enc;
        Object o = factory.nextObject();
        if (o instanceof PGPEncryptedDataList) {
            enc = (PGPEncryptedDataList) o;
        } else {
            enc = (PGPEncryptedDataList) factory.nextObject();
        }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

        PGPEncryptedDataList enc;
        Object o = factory.nextObject();
        if (o instanceof PGPEncryptedDataList) {
            enc = (PGPEncryptedDataList) o;
        } else {
            enc = (PGPEncryptedDataList) factory.nextObject();
        }
        encryptedInput.reset(); // nextObject() method reads from the InputStream, so rewind it!
        Iterator encryptedDataObjects = enc.getEncryptedDataObjects();
        PGPPrivateKey privateKey = null;
        PGPPublicKeyEncryptedData encryptedData;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

            IOUtils.closeQuietly(encryptedStream);
        }

        PGPObjectFactory pgpF = new PGPObjectFactory(in);
        PGPEncryptedDataList enc;
        Object o = pgpF.nextObject();

        // the first object might be a PGP marker packet.
        if (o instanceof PGPEncryptedDataList) {
            enc = (PGPEncryptedDataList) o;
        } else {
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

        // the first object might be a PGP marker packet.
        if (o instanceof PGPEncryptedDataList) {
            enc = (PGPEncryptedDataList) o;
        } else {
            enc = (PGPEncryptedDataList) pgpF.nextObject();
        }
        IOHelper.close(in);

        PGPPublicKeyEncryptedData pbe = (PGPPublicKeyEncryptedData) enc.get(0);
        InputStream clear = pbe.getDataStream(key, "BC");
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

        PGPPublicKeyEncryptedData pbe = (PGPPublicKeyEncryptedData) enc.get(0);
        InputStream clear = pbe.getDataStream(key, "BC");

        PGPObjectFactory pgpFact = new PGPObjectFactory(clear);
        PGPCompressedData cData = (PGPCompressedData) pgpFact.nextObject();
        pgpFact = new PGPObjectFactory(cData.getDataStream());
        PGPLiteralData ld = (PGPLiteralData) pgpFact.nextObject();

        byte[] answer;
        try {
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPObjectFactory.nextObject()

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

        PGPObjectFactory pgpFact = new PGPObjectFactory(clear);
        PGPCompressedData cData = (PGPCompressedData) pgpFact.nextObject();
        pgpFact = new PGPObjectFactory(cData.getDataStream());
        PGPLiteralData ld = (PGPLiteralData) pgpFact.nextObject();

        byte[] answer;
        try {
            answer = Streams.readAll(ld.getInputStream());
        } finally {
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.