Examples of PGPPublicKey


Examples of org.bouncycastle.openpgp.PGPPublicKey

  private static PGPPublicKey selectKey(final PGPPublicKeyRingCollection rings) {
    for (final Iterator<?> ri = rings.getKeyRings(); ri.hasNext();) {
      final PGPPublicKeyRing currRing = (PGPPublicKeyRing) ri.next();
      for (final Iterator<?> ki = currRing.getPublicKeys(); ki.hasNext();) {
        final PGPPublicKey k = (PGPPublicKey) ki.next();
        if (k.isEncryptionKey()) {
          return k;
        }
      }
    }
    return null;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

            Security.addProvider(new BouncyCastleProvider());
        }
    }

    public void marshal(Exchange exchange, Object graph, OutputStream outputStream) throws Exception {
        PGPPublicKey key = PGPDataFormatUtil.findPublicKey(exchange.getContext(), this.keyFileName, this.keyUserid);
        if (key == null) {
            throw new IllegalArgumentException("Public key is null, cannot proceed");
        }

        byte[] plaintextData;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

    public static PGPPublicKey findPublicKey(CamelContext context, String filename, String userid) throws IOException, PGPException,
            NoSuchProviderException {

        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), filename);
        PGPPublicKey privKey;
        try {
            privKey = findPublicKey(context, is, userid);
        } finally {
            IOHelper.close(is);
        }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

            PGPPublicKeyRing keyRing = keyRingIter.next();

            Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys();
            String keyUserId = null;
            while (keyIter.hasNext()) {
                PGPPublicKey key = keyIter.next();
                for (Iterator<String> iterator = key.getUserIDs(); iterator.hasNext();) {
                    keyUserId = iterator.next();
                }
                if (key.isEncryptionKey() && keyUserId != null && keyUserId.contains(userid)) {
                    return key;
                }
            }
        }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

            Security.addProvider(new BouncyCastleProvider());
        }
    }

    public void marshal(Exchange exchange, Object graph, OutputStream outputStream) throws Exception {
        PGPPublicKey key = PGPDataFormatUtil.findPublicKey(exchange.getContext(), this.keyFileName, this.keyUserid);
        if (key == null) {
            throw new IllegalArgumentException("Public key is null, cannot proceed");
        }

        InputStream plaintextStream = ExchangeHelper.convertToMandatoryType(exchange, InputStream.class, graph);
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

    public static PGPPublicKey findPublicKey(CamelContext context, String filename, String userid) throws IOException, PGPException,
            NoSuchProviderException {

        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), filename);
        PGPPublicKey privKey;
        try {
            privKey = findPublicKey(context, is, userid);
        } finally {
            IOHelper.close(is);
        }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

            PGPPublicKeyRing keyRing = keyRingIter.next();

            Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys();
            String keyUserId = null;
            while (keyIter.hasNext()) {
                PGPPublicKey key = keyIter.next();
                for (Iterator<String> iterator = key.getUserIDs(); iterator.hasNext();) {
                    keyUserId = iterator.next();
                }
                if (key.isEncryptionKey() && keyUserId != null && keyUserId.contains(userid)) {
                    return key;
                }
            }
        }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

            PGPPublicKeyRing keyRing = (PGPPublicKeyRing) keyRingIter.next();

            @SuppressWarnings("rawtypes")
            Iterator keyIter = keyRing.getPublicKeys();
            while (keyIter.hasNext()) {
                PGPPublicKey key = (PGPPublicKey) keyIter.next();

                if (key.isEncryptionKey()) {
                    return key;
                }
            }
        }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

        }
        List<String> allowedUserIds = determineSignaturenUserIds(exchange);
        for (int i = 0; i < signatureList.size(); i++) {
            PGPOnePassSignature signature = signatureList.get(i);
            // Determine public key from signature keyId
            PGPPublicKey sigPublicKey = publicKeyAccessor.getPublicKey(exchange, signature.getKeyID(), allowedUserIds);
            if (sigPublicKey == null) {
                continue;
            }
            // choose that signature for which a public key exists!
            signature.init(new JcaPGPContentVerifierBuilderProvider().setProvider(getProvider()), sigPublicKey);
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

        }
        List<String> allowedUserIds = determineSignaturenUserIds(exchange);
        for (int i = 0; i < signatureList.size(); i++) {
            PGPOnePassSignature signature = signatureList.get(i);
            // Determine public key from signature keyId
            PGPPublicKey sigPublicKey = publicKeyAccessor.getPublicKey(exchange, signature.getKeyID(), allowedUserIds);
            if (sigPublicKey == null) {
                continue;
            }
            // choose that signature for which a public key exists!
            signature.init(new JcaPGPContentVerifierBuilderProvider().setProvider(getProvider()), sigPublicKey);
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.