Examples of PGPPublicKeyRingCollection


Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

    }

    @SuppressWarnings("unchecked")
    private static PGPPublicKey findPublicKey(InputStream input, String userid, boolean forEncryption) throws IOException, PGPException,
            NoSuchProviderException {
        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));

        Iterator<PGPPublicKeyRing> keyRingIter = pgpSec.getKeyRings();
        while (keyRingIter.hasNext()) {
            PGPPublicKeyRing keyRing = keyRingIter.next();

            Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys();
            String keyUserId = null;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

    }

    @SuppressWarnings("unchecked")
    private static PGPPublicKey findPublicKeyWithKeyId(InputStream input, long keyid) throws IOException, PGPException,
            NoSuchProviderException {
        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));

        for (Iterator<PGPPublicKeyRing> keyRingIter = pgpSec.getKeyRings(); keyRingIter.hasNext();) {
            PGPPublicKeyRing keyRing = keyRingIter.next();
            for (Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys(); keyIter.hasNext();) {
                PGPPublicKey key = keyIter.next();
                if (keyid == key.getKeyID()) {
                    return key;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

    @SuppressWarnings("unchecked")
    private static List<PGPPublicKey> findPublicKeys(InputStream input, List<String> userids, boolean forEncryption) throws IOException,
            PGPException, NoSuchProviderException {
        List<PGPPublicKey> result = new ArrayList<PGPPublicKey>(3);

        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));

        for (Iterator<PGPPublicKeyRing> keyRingIter = pgpSec.getKeyRings(); keyRingIter.hasNext();) {
            PGPPublicKeyRing keyRing = keyRingIter.next();
            for (Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys(); keyIter.hasNext();) {
                PGPPublicKey key = keyIter.next();
                for (Iterator<String> iterator = key.getUserIDs(); iterator.hasNext();) {
                    String keyUserId = iterator.next();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

    }

    @SuppressWarnings("unchecked")
    private static PGPPublicKey findPublicKeyWithKeyId(InputStream input, long keyid) throws IOException, PGPException,
            NoSuchProviderException {
        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));

        for (Iterator<PGPPublicKeyRing> keyRingIter = pgpSec.getKeyRings(); keyRingIter.hasNext();) {
            PGPPublicKeyRing keyRing = keyRingIter.next();
            PGPPublicKey key = keyRing.getPublicKey(keyid);
            if (key != null) {
                return key;
            }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

    @SuppressWarnings("unchecked")
    private static List<PGPPublicKey> findPublicKeys(InputStream input, List<String> userids, boolean forEncryption) throws IOException,
            PGPException, NoSuchProviderException {
        List<PGPPublicKey> result = new ArrayList<PGPPublicKey>(3);

        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));

        for (Iterator<PGPPublicKeyRing> keyRingIter = pgpSec.getKeyRings(); keyRingIter.hasNext();) {
            PGPPublicKeyRing keyRing = keyRingIter.next();
            Set<String> keyUserIds = getUserIds(keyRing);
            for (Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys(); keyIter.hasNext();) {
                PGPPublicKey key = keyIter.next();
                for (String useridPart : userids) {
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

        throw new IllegalArgumentException("Can't find signing key in key ring.");
    }

    static PGPPublicKey readPublicKey(String keyringPath) throws Exception {
        InputStream input = new ByteArrayInputStream(getKeyRing(keyringPath));
        PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));

        @SuppressWarnings("rawtypes")
        Iterator keyRingIter = pgpPub.getKeyRings();
        while (keyRingIter.hasNext()) {
            PGPPublicKeyRing keyRing = (PGPPublicKeyRing) keyRingIter.next();

            @SuppressWarnings("rawtypes")
            Iterator keyIter = keyRing.getPublicKeys();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

    }

    @SuppressWarnings("unchecked")
    public static PGPPublicKey findPublicKey(CamelContext context, InputStream input, String userid) throws IOException, PGPException,
            NoSuchProviderException {
        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));

        Iterator<PGPPublicKeyRing> keyRingIter = (Iterator<PGPPublicKeyRing>) pgpSec.getKeyRings();
        while (keyRingIter.hasNext()) {
            PGPPublicKeyRing keyRing = keyRingIter.next();

            Iterator<PGPPublicKey> keyIter = (Iterator<PGPPublicKey>) keyRing.getPublicKeys();
            String keyUserId = null;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

    }

    private void readPublicKeyRing() throws Exception
    {
        InputStream in = IOUtils.getResourceAsStream(getPublicKeyRingFileName(), getClass());
        PGPPublicKeyRingCollection collection = new PGPPublicKeyRingCollection(in);
        in.close();
       
        for (Iterator iterator = collection.getKeyRings(); iterator.hasNext();)
        {
            PGPPublicKeyRing ring = (PGPPublicKeyRing) iterator.next();
            String userID = "";
            for (Iterator iterator2 = ring.getPublicKeys(); iterator2.hasNext();)
            {
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

    }

    @SuppressWarnings("unchecked")
    private static PGPPublicKey findPublicKey(InputStream input, String userid, boolean forEncryption) throws IOException, PGPException,
            NoSuchProviderException {
        PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));

        Iterator<PGPPublicKeyRing> keyRingIter = pgpSec.getKeyRings();
        while (keyRingIter.hasNext()) {
            PGPPublicKeyRing keyRing = keyRingIter.next();

            Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys();
            String keyUserId = null;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

            }
        }

        out.close();

        PGPPublicKeyRingCollection pgpRings = new PGPPublicKeyRingCollection(keyIn);

        PGPObjectFactory           pgpFact = new PGPObjectFactory(aIn);
        PGPSignatureList           p3 = (PGPSignatureList)pgpFact.nextObject();
        PGPSignature               sig = p3.get(0);

        sig.initVerify(pgpRings.getPublicKey(sig.getKeyID()), "BC");

        //
        // read the input, making sure we ingore the last newline.
        //
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.