Package org.bouncycastle.openpgp

Examples of org.bouncycastle.openpgp.PGPSecretKey.extractPrivateKey()


        //
        pgpPriv = new PGPSecretKeyRing(pgp8Key);
       
        secretKey = pgpPriv.getSecretKey();
       
        pgpPrivKey = secretKey.extractPrivateKey(pgp8Pass, "BC");

        //
        // expiry
        //
        testExpiry(expiry60and30daysSig13Key, 60, 30);
View Full Code Here


        String message,
        String type)
        throws Exception
    {
        PGPSecretKey                    pgpSecKey = readSecretKey(new ByteArrayInputStream(secretKey));
        PGPPrivateKey                   pgpPrivKey = pgpSecKey.extractPrivateKey("".toCharArray(), "BC");
        PGPSignatureGenerator           sGen = new PGPSignatureGenerator(pgpSecKey.getPublicKey().getAlgorithm(), PGPUtil.SHA256, "BC");
        PGPSignatureSubpacketGenerator  spGen = new PGPSignatureSubpacketGenerator();

        sGen.initSign(PGPSignature.CANONICAL_TEXT_DOCUMENT, pgpPrivKey);
View Full Code Here

        PGPSecretKey sigSecretKey = PGPDataFormatUtil.findSecretKey(exchange.getContext(), sigKeyFileName, sigKeyPassword);
        if (sigSecretKey == null) {
            throw new IllegalArgumentException("Signature secret key is null, cannot proceed");
        }

        PGPPrivateKey sigPrivateKey = sigSecretKey.extractPrivateKey(sigKeyPassword.toCharArray(), "BC");
        if (sigPrivateKey == null) {
            throw new IllegalArgumentException("Signature private key is null, cannot proceed");
        }

        PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
View Full Code Here

        PGPPrivateKey privateKey = null;
        PGPPublicKeyEncryptedData encryptedData;
        while (privateKey == null && encryptedDataObjects.hasNext()) {
            encryptedData = (PGPPublicKeyEncryptedData) encryptedDataObjects.next();
            PGPSecretKey pgpSecKey = pgpSec.getSecretKey(encryptedData.getKeyID());
            privateKey = pgpSecKey.extractPrivateKey(passphrase.toCharArray(), "BC");
        }
        return privateKey;
    }

    public static PGPSecretKey findSecretKey(CamelContext context, String keychainFilename, String passphrase)
View Full Code Here

        for (Iterator<?> i = pgpSec.getKeyRings(); i.hasNext() && pgpSecKey == null;) {
            Object data = i.next();
            if (data instanceof PGPSecretKeyRing) {
                PGPSecretKeyRing keyring = (PGPSecretKeyRing) data;
                PGPSecretKey secKey = keyring.getSecretKey();
                PGPPrivateKey privateKey = secKey.extractPrivateKey(passphrase.toCharArray(), "BC");
                if (privateKey != null) {
                    pgpSecKey = secKey;
                }
            }
        }
View Full Code Here

        if (pgpSecKey == null)
        {
            return null;
        }
       
        return pgpSecKey.extractPrivateKey(pass, "BC");
    }
   
    /**
     * decrypt the passed in message stream
     */
 
View Full Code Here

        if (pgpSecKey == null)
        {
            return null;
        }
       
        return pgpSecKey.extractPrivateKey(pass, "BC");
    }
   
    /**
     * decrypt the passed in message stream
     */
 
View Full Code Here

        {
            digest = PGPUtil.SHA1;
        }
       
        PGPSecretKey                    pgpSecKey = readSecretKey(keyIn);
        PGPPrivateKey                   pgpPrivKey = pgpSecKey.extractPrivateKey(pass, "BC");       
        PGPSignatureGenerator           sGen = new PGPSignatureGenerator(pgpSecKey.getPublicKey().getAlgorithm(), digest, "BC");
        PGPSignatureSubpacketGenerator  spGen = new PGPSignatureSubpacketGenerator();
       
        sGen.initSign(PGPSignature.CANONICAL_TEXT_DOCUMENT, pgpPrivKey);
       
View Full Code Here

        {
            out = new ArmoredOutputStream(out);
        }
       
        PGPSecretKey             pgpSec = readSecretKey(keyIn);
        PGPPrivateKey            pgpPrivKey = pgpSec.extractPrivateKey(pass, "BC");       
        PGPSignatureGenerator    sGen = new PGPSignatureGenerator(pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1, "BC");
       
        sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
       
        BCPGOutputStream         bOut = new BCPGOutputStream(out);
View Full Code Here

        {
            out = new ArmoredOutputStream(out);
        }
       
        PGPSecretKey                pgpSec = readSecretKey(keyIn);
        PGPPrivateKey               pgpPrivKey = pgpSec.extractPrivateKey(pass, "BC");       
        PGPSignatureGenerator       sGen = new PGPSignatureGenerator(pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1, "BC");
       
        sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
       
        Iterator    it = pgpSec.getPublicKey().getUserIDs();
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.