Package org.bouncycastle.cms

Examples of org.bouncycastle.cms.SignerInfoGenerator


   @Test
   public void testPythonVerified() throws Exception
   {
      SMIMESignedGenerator gen = new SMIMESignedGenerator();
      SignerInfoGenerator signer = new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC").build("SHA1WITHRSA", privateKey, cert);
      gen.addSignerInfoGenerator(signer);

      MimeMultipart mp = gen.generate(createMsg());
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      mp.writeTo(os);
View Full Code Here


   @Test
   public void testPythonVerifiedBad() throws Exception
   {
      SMIMESignedGenerator gen = new SMIMESignedGenerator();
      SignerInfoGenerator signer = new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC").build("SHA1WITHRSA", badKey, cert);
      gen.addSignerInfoGenerator(signer);

      MimeMultipart mp = gen.generate(createMsg());
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      mp.writeTo(os);
View Full Code Here

   public void writeTo(SignedOutput out, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> headers, OutputStream os) throws IOException, WebApplicationException
   {
      try
      {
         SMIMESignedGenerator gen = new SMIMESignedGenerator();
         SignerInfoGenerator signer = new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC").build("SHA1WITHRSA", out.getPrivateKey(), out.getCertificate());
         gen.addSignerInfoGenerator(signer);

         MimeMultipart mp = gen.generate(EnvelopedWriter.createBodyPart(providers, out));
         String contentType = mp.getContentType();
         contentType = contentType.replace("\r\n", "").replace("\t", " ");
View Full Code Here

      digestCalculatorProviderBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
      DigestCalculatorProvider digestCalculatorProvider = digestCalculatorProviderBuilder.build();

      JcaSignerInfoGeneratorBuilder signerInfoGeneratorBuilder = new JcaSignerInfoGeneratorBuilder(digestCalculatorProvider);

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

      this.timeStampTokenGenerator = new TimeStampTokenGenerator(signerInfoGenerator, new ASN1ObjectIdentifier(BouncyCastleTimeStampServer.TSA_POLICY_ID));

      JcaCertStore certStore = new JcaCertStore(Arrays.asList(chain));
      this.timeStampTokenGenerator.addCertificates(certStore);
View Full Code Here

        digestCalculatorProviderBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
        DigestCalculatorProvider digestCalculatorProvider = digestCalculatorProviderBuilder.build();

        JcaSignerInfoGeneratorBuilder signerInfoGeneratorBuilder = new JcaSignerInfoGeneratorBuilder(digestCalculatorProvider);

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

      cmsSignedDataGenerator.addCertificates(this.getCertificateStore());
      CMSTypedData content = new CMSProcessableByteArray(data);
View Full Code Here

      digestCalculatorProviderBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
      DigestCalculatorProvider digestCalculatorProvider = digestCalculatorProviderBuilder.build();

      JcaSignerInfoGeneratorBuilder signerInfoGeneratorBuilder = new JcaSignerInfoGeneratorBuilder(digestCalculatorProvider);

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

      this.timeStampTokenGenerator = new TimeStampTokenGenerator(signerInfoGenerator, new ASN1ObjectIdentifier(BouncyCastleTimeStampServer.TSA_POLICY_ID));

      JcaCertStore certStore = new JcaCertStore(Arrays.asList(chain));
      this.timeStampTokenGenerator.addCertificates(certStore);
View Full Code Here

        // AttributeTable table = new AttributeTable(hashtable);
        // CMSAttributeTableGenerator attributeTableGenerator = new DefaultSignedAttributeTableGenerator(table);
        // signerInfoGeneratorBuilder.setSignedAttributeGenerator(attributeTableGenerator);
        // }

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

        cmsSignedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
        cmsSignedDataGenerator.addCertificates(this.getCertificateStore(chain));
      }
View Full Code Here

      digestCalculatorProviderBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
      DigestCalculatorProvider digestCalculatorProvider = digestCalculatorProviderBuilder.build();

      JcaSignerInfoGeneratorBuilder signerInfoGeneratorBuilder = new JcaSignerInfoGeneratorBuilder(digestCalculatorProvider);

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

      DigestCalculator digestCalculator = digestCalculatorProvider.get(signerInfoGenerator.getDigestAlgorithm());

      this.timeStampTokenGenerator = new TimeStampTokenGenerator(digestCalculator, signerInfoGenerator, new ASN1ObjectIdentifier(BouncyCastleTimeStampServer.TSA_POLICY_ID));

      JcaCertStore certStore = new JcaCertStore(Arrays.asList(chain));
      this.timeStampTokenGenerator.addCertificates(certStore);
View Full Code Here

          ASN1EncodableVector v = new ASN1EncodableVector();
          v.add(attr);
          signerInfoGeneratorBuilder.setSignedAttributeGenerator(new DefaultSignedAttributeTableGenerator(new AttributeTable(v)));
        }

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

        signedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
        signedDataGenerator.addCertificates(this.getCertificateStore(chain));
      }
View Full Code Here

          ASN1EncodableVector v = new ASN1EncodableVector();
          v.add(attr);
          signerInfoGeneratorBuilder.setSignedAttributeGenerator(new DefaultSignedAttributeTableGenerator(new AttributeTable(v)));
        }

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

        signedDataGenerator.addSignerInfoGenerator(signerInfoGenerator);
        signedDataGenerator.addCertificates(this.getCertificateStore(chain));
      }
View Full Code Here

TOP

Related Classes of org.bouncycastle.cms.SignerInfoGenerator

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.