Package org.bouncycastle.openpgp

Examples of org.bouncycastle.openpgp.PGPSignatureSubpacketGenerator.generate()


            svg = new PGPSignatureSubpacketGenerator();

            svg.setKeyExpirationTime(true, 86400L * 366 * 3);

            keySigGen.setHashedSubpackets(svg.generate());

            pKey = PGPPublicKey.addCertification(pKey, keySigGen.generateCertification(pKey));

            if (pKey.isEncryptionKey())
            {
View Full Code Here


        Iterator    it = pgpSecKey.getPublicKey().getUserIDs();
        if (it.hasNext())
        {
            spGen.setSignerUserID(false, (String)it.next());
            sGen.setHashedSubpackets(spGen.generate());
        }
       
        ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
        ArmoredOutputStream    aOut = new ArmoredOutputStream(bOut);
        ByteArrayInputStream   bIn = new ByteArrayInputStream(message.getBytes());
View Full Code Here

        Iterator        it = sKey.getSecretKey().getPublicKey().getUserIDs();
        String          primaryUserID = (String)it.next();
       
        spGen.setSignerUserID(true, primaryUserID);
       
        sGen.setHashedSubpackets(spGen.generate());
       
        PGPCompressedDataGenerator cGen = new PGPCompressedDataGenerator(
                                                                PGPCompressedData.ZIP);

        BCPGOutputStream bcOut = new BCPGOutputStream(
View Full Code Here

  }

  private PGPSignatureSubpacketVector generateSubKeySettings() {
    final PGPSignatureSubpacketGenerator settings = new PGPSignatureSubpacketGenerator();
    settings.setKeyFlags(false, IntegerEquivalents.toBitmask(KeyFlag.SUB_KEY_DEFAULTS));
    return settings.generate();
  }

  private PGPSignatureSubpacketVector generateMasterKeySettings() {
    final PGPSignatureSubpacketGenerator settings = new PGPSignatureSubpacketGenerator();
    settings.setKeyFlags(false,
View Full Code Here

            CompressionAlgorithm.ZLIB,
            CompressionAlgorithm.ZIP
          )
        )
    );
    return settings.generate();
  }

  private Future<KeyPair> generateKeyPair(final AsymmetricAlgorithm algorithm) {
    return executor.submit(new GeneratorTask(algorithm, random));
  }
View Full Code Here

      "BC");
    signatureGenerator.initSign(PGPSignature.BINARY_DOCUMENT, owner.getPrivateKey());

    final PGPSignatureSubpacketGenerator signatureMetaData = new PGPSignatureSubpacketGenerator();
    signatureMetaData.setSignerUserID(false, owner.getUserID());
    signatureGenerator.setHashedSubpackets(signatureMetaData.generate());
    return signatureGenerator;
  }
 
  private OutputStream getLiteralWrapper(OutputStream output) throws Exception {
    return new PGPLiteralDataGenerator().open(output,
View Full Code Here

        spGen.setSignerUserID(false, sigKeyUserid);

        int algorithm = sigSecretKey.getPublicKey().getAlgorithm();
        PGPSignatureGenerator sigGen = new PGPSignatureGenerator(algorithm, HashAlgorithmTags.SHA1, "BC");
        sigGen.initSign(PGPSignature.BINARY_DOCUMENT, sigPrivateKey);
        sigGen.setHashedSubpackets(spGen.generate());
        sigGen.generateOnePassVersion(false).encode(out);
        return sigGen;
    }

    public Object unmarshal(Exchange exchange, InputStream encryptedStream) throws Exception {
View Full Code Here

        boolean isHumanReadable = true;

        spGen.setNotationData(true, isHumanReadable, notationName, notationValue);

        PGPSignatureSubpacketVector packetVector = spGen.generate();
        sGen.setHashedSubpackets(packetVector);

        bOut.flush();

        return PGPPublicKey.addCertification(keyToBeSigned, sGen.generate()).getEncoded();
View Full Code Here

       
        Iterator    it = pgpSecKey.getPublicKey().getUserIDs();
        if (it.hasNext())
        {
            spGen.setSignerUserID(false, (String)it.next());
            sGen.setHashedSubpackets(spGen.generate());
        }
       
        FileInputStream        fIn = new FileInputStream(fileName);
        ArmoredOutputStream    aOut = new ArmoredOutputStream(out);
       
View Full Code Here

        if (it.hasNext())
        {
            PGPSignatureSubpacketGenerator  spGen = new PGPSignatureSubpacketGenerator();
           
            spGen.setSignerUserID(false, (String)it.next());
            sGen.setHashedSubpackets(spGen.generate());
        }
       
        PGPCompressedDataGenerator  cGen = new PGPCompressedDataGenerator(
                                                                PGPCompressedData.ZLIB);
       
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.