Examples of PGPSecretKeyRing


Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

       
        secretRings = new PGPSecretKeyRingCollection(encRing);
       
        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();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

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

                PGPSecretKey    k = (PGPSecretKey)it.next();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

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

                PGPSecretKey    k = (PGPSecretKey)it.next();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

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

                PGPSecretKey    k = (PGPSecretKey)it.next();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

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

                PGPSecretKey    k = (PGPSecretKey)it.next();
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

    }
   
    public void test10()
        throws Exception
    {
        PGPSecretKeyRing    secretRing = new PGPSecretKeyRing(sec10, new BcKeyFingerprintCalculator());
        Iterator            secretKeys = secretRing.getSecretKeys();
       
        while (secretKeys.hasNext())
        {
            PGPPublicKey pubKey = ((PGPSecretKey)secretKeys.next()).getPublicKey();
           
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

        PGPKeyRingGenerator    keyRingGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION, dsaKeyPair,
                "test", PGPEncryptedData.AES_256, passPhrase, null, null, new SecureRandom(), "BC");
   
        keyRingGen.addSubKey(elgKeyPair);
   
        PGPSecretKeyRing       keyRing = keyRingGen.generateSecretKeyRing();
       
        keyRing.getSecretKey().extractPrivateKey(new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider()).build(passPhrase));
       
        PGPPublicKeyRing        pubRing = keyRingGen.generatePublicKeyRing();
       
        PGPPublicKey            vKey = null;
        PGPPublicKey            sKey = null;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

                          rsaKp = rsaKpg.generateKeyPair();
        PGPKeyPair        rsaKeyPair2 = new PGPKeyPair(PGPPublicKey.RSA_GENERAL, rsaKp, new Date());

        PGPKeyRingGenerator    keyRingGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION, rsaKeyPair1,
                "test", PGPEncryptedData.AES_256, passPhrase, null, null, new SecureRandom(), "BC");
        PGPSecretKeyRing       secRing1 = keyRingGen.generateSecretKeyRing();
        PGPPublicKeyRing       pubRing1 = keyRingGen.generatePublicKeyRing();
        keyRingGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION, rsaKeyPair2,
                "test", PGPEncryptedData.AES_256, passPhrase, null, null, new SecureRandom(), "BC");
        PGPSecretKeyRing       secRing2 = keyRingGen.generateSecretKeyRing();
        PGPPublicKeyRing       pubRing2 = keyRingGen.generatePublicKeyRing();

        try
        {
            PGPPublicKeyRing.insertPublicKey(pubRing1, pubRing2.getPublicKey());
            fail("adding second master key (public) should throw an IllegalArgumentException");
        }
        catch (IllegalArgumentException e)
        {
            if (!e.getMessage().equals("cannot add a master key to a ring that already has one"))
            {
                fail("wrong message in public test");
            }
        }

        try
        {
            PGPSecretKeyRing.insertSecretKey(secRing1, secRing2.getSecretKey());
            fail("adding second master key (secret) should throw an IllegalArgumentException");
        }
        catch (IllegalArgumentException e)
        {
            if (!e.getMessage().equals("cannot add a master key to a ring that already has one"))
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

        PGPKeyRingGenerator    keyRingGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION, dsaKeyPair,
                "test", PGPEncryptedData.AES_256, passPhrase, true, null, null, new SecureRandom(), "BC");
   
        keyRingGen.addSubKey(elgKeyPair);
   
        PGPSecretKeyRing       keyRing = keyRingGen.generateSecretKeyRing();
       
        keyRing.getSecretKey().extractPrivateKey(new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider()).build(passPhrase));
       
        PGPPublicKeyRing        pubRing = keyRingGen.generatePublicKeyRing();
       
        PGPPublicKey            vKey = null;
        PGPPublicKey            sKey = null;
View Full Code Here

Examples of org.bouncycastle.openpgp.PGPSecretKeyRing

        Iterator rIt = privRings.getKeyRings();

        if (rIt.hasNext())
        {
            PGPSecretKeyRing pgpPriv = (PGPSecretKeyRing)rIt.next();

            Iterator it = pgpPriv.getSecretKeys();

            while (it.hasNext())
            {
                PGPSecretKey pgpKey = (PGPSecretKey)it.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.