Package org.bouncycastle.cms

Examples of org.bouncycastle.cms.CMSTypedData


            PrivateKey key = getPrivateKey(args[1]);
            System.out.println("File read sucessfully");

            CMSSignedDataGenerator generator = new CMSSignedDataGenerator();

            CMSTypedData body = getCMSContent(args[0]);
            System.out.println("Content read sucessfully");

            X509Certificate cert = (X509Certificate) readCert(args[2]);
            System.out.println("Certificate read sucessfully");
View Full Code Here


  Store certs = new JcaCertStore(Collections.singleton(cert));
  gen.addSignerInfoGenerator(new JcaSignerInfoGeneratorBuilder(
    new JcaDigestCalculatorProviderBuilder().build()).build(
    sha1Signer, cert));
  gen.addCertificates(certs);
  CMSTypedData msg = new CMSAbsentContent();
  CMSSignedData sigData = gen.generate(msg, false);

  params.add(new Object[] { new GetCert(transId, senderNonce, iasn) });
  params.add(new Object[] { new GetCertInitial(transId, senderNonce, ias) });
  params.add(new Object[] { new GetCrl(transId, senderNonce, iasn) });
View Full Code Here

   */
  public CMSEnvelopedData encode(byte[] messageData)
      throws MessageEncodingException {
    LOGGER.debug("Encoding pkcsPkiEnvelope");
    CMSEnvelopedDataGenerator edGenerator = new CMSEnvelopedDataGenerator();
    CMSTypedData envelopable = new CMSProcessableByteArray(messageData);
    RecipientInfoGenerator recipientGenerator;
    try {
      recipientGenerator = new JceKeyTransRecipientInfoGenerator(
          recipient);
    } catch (CertificateEncodingException e) {
View Full Code Here

  public void write(final Certificate[] chain, final OutputStream outputStream) {
    Assert.notEmpty(chain, "chain");
    Assert.notNull(outputStream, "outputStream");
    try {
      CMSSignedDataGenerator signedDataGenerator = new CMSSignedDataGenerator();
      CMSTypedData content = new CMSAbsentContent();

      signedDataGenerator.addCertificates(BouncyCastleProviderHelper.toStore(chain));

      CMSSignedData signedData = signedDataGenerator.generate(content, false);
      byte[] bytes = signedData.getEncoded();
View Full Code Here

        signedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
        signedDataGenerator.addCertificates(BouncyCastleProviderHelper.toStore(chain));
      }

      CMSTypedData content = null;
      boolean encapsulate = true;

      if (this.parameters.isDataDigested()) {
        content = new CMSAbsentContent();
        encapsulate = false;
View Full Code Here

        SignerInfoGenerator signerInfoGenerator = signerInfoGeneratorBuilder.build(contentSigner, (X509Certificate) certificate);
        cmsSignedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
      }

      cmsSignedDataGenerator.addCertificates(this.getCertificateStore());
      CMSTypedData content = new CMSProcessableByteArray(data);

      CMSSignedData signedData = cmsSignedDataGenerator.generate(content, true);

      if (timeStampClient != null) {
        SignerInformationStore signerInformationStore = signedData.getSignerInfos();
View Full Code Here

  public String sign(byte[] theBytes) throws SignatureFailureException {
    try {
      Security.addProvider(new BouncyCastleProvider());

      List<X509Certificate> certList = new ArrayList<X509Certificate>();
      CMSTypedData msg = new CMSProcessableByteArray(theBytes);

      X509Certificate signCert = (X509Certificate) myKeyStore.getCertificate(myKeyAlias);
      certList.add(signCert);

      Store certs = new JcaCertStore(certList);
View Full Code Here

        cmsSignedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
        cmsSignedDataGenerator.addCertificates(this.getCertificateStore(chain));
      }

      CMSTypedData content = new CMSProcessableByteArray(data);

      CMSSignedData signedData = cmsSignedDataGenerator.generate(content, true);

      if (timeStampClient != null) {
        SignerInformationStore signerInformationStore = signedData.getSignerInfos();
View Full Code Here

        signedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
        signedDataGenerator.addCertificates(this.getCertificateStore(chain));
      }

      CMSTypedData content = null;
      boolean encapsulate = true;

      if (this.parameters.isDataDigested()) {
        content = new CMSAbsentContent();
        encapsulate = false;
View Full Code Here

        signedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
        signedDataGenerator.addCertificates(this.getCertificateStore(chain));
      }

      CMSTypedData content = null;
      boolean encapsulate = true;

      if (this.parameters.isDataDigested()) {
        content = new CMSAbsentContent();
        encapsulate = false;
View Full Code Here

TOP

Related Classes of org.bouncycastle.cms.CMSTypedData

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.