Examples of PGPSecretKeyRingCollection


Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

    }
   
    public void test9()
        throws Exception
    {
        PGPSecretKeyRingCollection    secretRings = new PGPSecretKeyRingCollection(sec9);

        Iterator    rIt = secretRings.getKeyRings();
        int         count = 0;
       
        byte[] encRing = secretRings.getEncoded();
       
        secretRings = new PGPSecretKeyRingCollection(encRing);
       
        while (rIt.hasNext())
        {
            PGPSecretKeyRing         pgpSec = (PGPSecretKeyRing)rIt.next();
   
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

        throws Exception
    {
        SecureRandom rand = new SecureRandom();

        // Read the secret key rings
        PGPSecretKeyRingCollection privRings = new PGPSecretKeyRingCollection(
                                                         new ByteArrayInputStream(rewrapKey));

        Iterator rIt = privRings.getKeyRings();

        if (rIt.hasNext())
        {
            PGPSecretKeyRing pgpPriv = (PGPSecretKeyRing)rIt.next();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

    private void testSecretKeyRingWithPersonalCertificate()
        throws Exception
    {
        checkSecretKeyRingWithPersonalCertificate(secWithPersonalCertificate);
        PGPSecretKeyRingCollection secRing = new PGPSecretKeyRingCollection(secWithPersonalCertificate);
        checkSecretKeyRingWithPersonalCertificate(secRing.getEncoded());
    }
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

    }

    private void checkSecretKeyRingWithPersonalCertificate(byte[] keyRing)
        throws Exception
    {
        PGPSecretKeyRingCollection secCol = new PGPSecretKeyRingCollection(keyRing);


        int count = 0;

        for (Iterator rIt = secCol.getKeyRings(); rIt.hasNext();)
        {
            PGPSecretKeyRing ring = (PGPSecretKeyRing)rIt.next();

            for (Iterator it = ring.getExtraPublicKeys(); it.hasNext();)
            {
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

        if (count != 1)
        {
            fail("wrong number of public keyrings on case-insensitive partial match");
        }
       
        PGPSecretKeyRingCollection    secretRings = new PGPSecretKeyRingCollection(sec1);

        rIt = secretRings.getKeyRings();
        count = 0;
       
        while (rIt.hasNext())
        {
            PGPSecretKeyRing                    pgpSec = (PGPSecretKeyRing)rIt.next();
   
            count++;
           
            int    keyCount = 0;
           
            byte[]    bytes = pgpSec.getEncoded();
           
            pgpSec = new PGPSecretKeyRing(bytes);
           
            Iterator    it = pgpSec.getSecretKeys();
            while (it.hasNext())
            {
                keyCount++;

                PGPSecretKey    k = (PGPSecretKey)it.next();
                PGPPublicKey    pk = k.getPublicKey();
               
                pk.getSignatures();
               
                byte[] pkBytes = pk.getEncoded();
               
                PGPPublicKeyRing  pkR = new PGPPublicKeyRing(pkBytes, new BcKeyFingerprintCalculator());
            }
           
            if (keyCount != 2)
            {
                fail("wrong number of secret keys");
            }
        }
       
        if (count != 1)
        {
            fail("wrong number of secret keyrings");
        }
       
        //
        // exact match
        //
        rIt = secretRings.getKeyRings("test (Test key) <test@ubicall.com>");
        count = 0;
        while (rIt.hasNext())
        {
            count++;
            rIt.next();
        }
       
        if (count != 1)
        {
            fail("wrong number of secret keyrings on exact match");
        }
       
        //
        // partial match 1 expected
        //
        rIt = secretRings.getKeyRings("test", true);
        count = 0;
        while (rIt.hasNext())
        {
            count++;
            rIt.next();
        }
       
        if (count != 1)
        {
            fail("wrong number of secret keyrings on partial match 1");
        }
       
        //
        // exact match 0 expected
        //
        rIt = secretRings.getKeyRings("test", false);
        count = 0;
        while (rIt.hasNext())
        {
            count++;
            rIt.next();
        }
       
        if (count != 0)
        {
            fail("wrong number of secret keyrings on partial match 0");
        }

        //
        // case-insensitive partial match
        //
        rIt = secretRings.getKeyRings("TEST@ubicall.com", true, true);
        count = 0;
        while (rIt.hasNext())
        {
            count++;
            rIt.next();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

        if (count != 2)
        {
            fail("wrong number of public keyrings");
        }
       
        PGPSecretKeyRingCollection    secretRings = new PGPSecretKeyRingCollection(sec2);

        rIt = secretRings.getKeyRings();
        count = 0;
       
        encRing = secretRings.getEncoded();
       
        secretRings = new PGPSecretKeyRingCollection(encRing);
       
        while (rIt.hasNext())
        {
            PGPSecretKeyRing                    pgpSec = (PGPSecretKeyRing)rIt.next();
   
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

        if (count != 1)
        {
            fail("wrong number of public keyrings");
        }
       
        PGPSecretKeyRingCollection    secretRings = new PGPSecretKeyRingCollection(sec3);

        rIt = secretRings.getKeyRings();
        count = 0;
       
        encRing = secretRings.getEncoded();
       
        secretRings = new PGPSecretKeyRingCollection(encRing);
       
        while (rIt.hasNext())
        {
            PGPSecretKeyRing                    pgpSec = (PGPSecretKeyRing)rIt.next();
   
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

    }
   
    public void test4()
        throws Exception
    {
        PGPSecretKeyRingCollection    secretRings = new PGPSecretKeyRingCollection(sec4);

        Iterator    rIt = secretRings.getKeyRings();
        int            count = 0;
       
        byte[]    encRing = secretRings.getEncoded();
       
        secretRings = new PGPSecretKeyRingCollection(encRing);
       
        while (rIt.hasNext())
        {
            PGPSecretKeyRing                    pgpSec = (PGPSecretKeyRing)rIt.next();
   
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

        if (noIDEA())
        {
            return;
        }

        PGPSecretKeyRingCollection    secretRings = new PGPSecretKeyRingCollection(sec5);

        rIt = secretRings.getKeyRings();
        count = 0;
       
        encRing = secretRings.getEncoded();
       
        secretRings = new PGPSecretKeyRingCollection(encRing);
       
        while (rIt.hasNext())
        {
            PGPSecretKeyRing                    pgpSec = (PGPSecretKeyRing)rIt.next();
   
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRingCollection

        if (count != 2)
        {
            fail("wrong number of public keyrings");
        }
       
        PGPSecretKeyRingCollection    secretRings = new PGPSecretKeyRingCollection(sec8);

        rIt = secretRings.getKeyRings();
        count = 0;
       
        encRing = secretRings.getEncoded();
       
        secretRings = new PGPSecretKeyRingCollection(encRing);
       
        while (rIt.hasNext())
        {
            PGPSecretKeyRing         pgpSec = (PGPSecretKeyRing)rIt.next();
   
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.