Examples of PGPPublicKey


Examples of org.bouncycastle.openpgp.PGPPublicKey

public class PGPKeyRingTestCase extends AbstractEncryptionStrategyTestCase
{
    public void testClientKey()
    {
        PGPPublicKey clientKey = keyManager.getPublicKey("Mule client <mule_client@mule.com>");
        assertNotNull(clientKey);
    }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

        {
            PGPPublicKeyRing ring = (PGPPublicKeyRing) iterator.next();
            String userID = "";
            for (Iterator iterator2 = ring.getPublicKeys(); iterator2.hasNext();)
            {
                PGPPublicKey publicKey = (PGPPublicKey) iterator2.next();
                Iterator userIDs = publicKey.getUserIDs();
                if (userIDs.hasNext()) {
                    userID = (String) userIDs.next();
                }
                principalsKeyBundleMap.put(userID, publicKey);
            }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

    public InputStream encrypt(InputStream data, Object cryptInfo) throws CryptoFailureException
    {
        try
        {
            PGPCryptInfo pgpCryptInfo = this.safeGetCryptInfo(cryptInfo);
            PGPPublicKey publicKey = pgpCryptInfo.getPublicKey();
            return new LazyInputStream(new EncryptOutputStreamWriter(data, publicKey));
        }
        catch (Exception e)
        {
            throw new CryptoFailureException(this, e);
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

    public InputStream decrypt(InputStream data, Object cryptInfo) throws CryptoFailureException
    {
        try
        {
            PGPCryptInfo pgpCryptInfo = this.safeGetCryptInfo(cryptInfo);
            PGPPublicKey publicKey = pgpCryptInfo.getPublicKey();
            return new LazyInputStream(new DecryptOutputStreamWriter(data, publicKey,
                this.keyManager.getSecretKey(), this.keyManager.getSecretPassphrase()));
        }
        catch (Exception e)
        {
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

    private PGPCryptInfo safeGetCryptInfo(Object cryptInfo)
    {
        if (cryptInfo == null)
        {
            MuleEvent event = RequestContext.getEvent();
            PGPPublicKey publicKey = keyManager.getPublicKey((String) this.getCredentialsAccessor().getCredentials(event));
            this.checkKeyExpirity(publicKey);
            return new PGPCryptInfo(publicKey, false);
        }
        else
        {
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

    protected String findSignatureKeyPassword(Exchange exchange) {
        return exchange.getIn().getHeader(SIGNATURE_KEY_PASSWORD, signaturePassword, String.class);
    }

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

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

Examples of org.bouncycastle.openpgp.PGPPublicKey

    }

    protected PGPOnePassSignature getSignature(Exchange exchange, PGPOnePassSignatureList signatureList)
        throws IOException, PGPException, NoSuchProviderException {

        PGPPublicKey sigPublicKey = PGPDataFormatUtil.findPublicKey(exchange.getContext(), findSignatureKeyFileName(exchange), findSignatureKeyUserid(exchange), false);
        if (sigPublicKey == null) {
            throw new IllegalArgumentException("Signature public key is null, cannot proceed");
        }

        PGPOnePassSignature signature = signatureList.get(0);
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPPublicKey

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

        InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context.getClassResolver(), filename);
        PGPPublicKey pubKey;
        try {
            pubKey = findPublicKey(is, userid, forEncryption);
        } 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 (keyUserId != null && keyUserId.contains(userid)) {
                    if (forEncryption && key.isEncryptionKey()) {
                        return key;
                    } else if (!forEncryption && isSignatureKey(key)) {
                        return key;
                    }
                }
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.