Package org.bouncycastle.openpgp

Examples of org.bouncycastle.openpgp.PGPPublicKeyRingCollection


            }
        }

        private PGPPublicKey loadPublicKey(long keyId) throws FileNotFoundException, IOException, PGPException {
            InputStream keyIn = verificationKey.getKeyData();
            PGPPublicKeyRingCollection pgpRing;
            try {
                pgpRing = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(keyIn));
            } finally {
                KongaIoUtils.close(keyIn);
            }
            PGPPublicKey key = pgpRing.getPublicKey(keyId);
            return key;
        }
View Full Code Here


        pgpAssertNotNull(p2);
        final InputStream dIn = p2.getInputStream();
        pgpAssertNotNull(dIn);
        int ch;
        final PGPPublicKeyRingCollection pgpRing = new PGPPublicKeyRingCollection(
                PGPUtil.getDecoderStream(keyIn));
        pgpAssertNotNull(ops);
        decodeKeyId = ops.getKeyID();
        if (decodeKeyId == null) {
            // there is no key in the key ring that can decode the license
            verified = false;
            licenseProperties = null;
        } else {
            final PGPPublicKey decodeKey = pgpRing.getPublicKey(decodeKeyId);
            final ByteArrayOutputStream out = new ByteArrayOutputStream();
            try {
                final PGPContentVerifierBuilderProvider cvBuilder = new JcaPGPContentVerifierBuilderProvider();
                ops.init(cvBuilder, decodeKey);
                while ((ch = dIn.read()) >= 0) {
View Full Code Here

    }

    @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

TOP

Related Classes of org.bouncycastle.openpgp.PGPPublicKeyRingCollection

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.