Package org.bouncycastle.cms

Examples of org.bouncycastle.cms.CMSEnvelopedDataStreamGenerator.open()


    public static void encrypt(final InputStream is, OutputStream os, X509Certificate cert) throws Exception {
        final InputStream bis = new BufferedInputStream(is, bufferSize);
        final OutputStream bos = new BufferedOutputStream(os, bufferSize);
        final CMSEnvelopedDataStreamGenerator edGen = new CMSEnvelopedDataStreamGenerator();
        edGen.addKeyTransRecipient(cert.getPublicKey(), "hej".getBytes() );
        final OutputStream out = edGen.open(bos, CMSEnvelopedGenerator.AES128_CBC, "BC");
        fromInToOut(bis, out);
        bos.close();
        os.close();
    }
    /**
 
View Full Code Here



         MimeBodyPart _msg = createBodyPart(providers, out);

         baos = new ByteArrayOutputStream();
         encrypted = generator.open(baos, encryptor);

         _msg.writeTo(encrypted);
         encrypted.close();
         byte[] bytes = baos.toByteArray();
         String str = Base64.encodeBytes(bytes, Base64.DO_BREAK_LINES);
View Full Code Here

      ih.addHeader("Content-Type", "application/xml");

      MimeBodyPart _msg = new MimeBodyPart(ih, "<customer name=\"bill\"/>".getBytes());

      ByteArrayOutputStream os = new ByteArrayOutputStream();
      OutputStream encrypted = generator.open(os, encryptor);

      _msg.writeTo(encrypted);
      encrypted.close();

      String str = Base64.encodeBytes(os.toByteArray(), Base64.DO_BREAK_LINES);
View Full Code Here

   
        edGen.addKeyTransRecipient(_reciCert);
   
        ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
       
        OutputStream out = edGen.open(
                                bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
   
        for (int i = 0; i != 2000; i++)
        {
            out.write(data[i]);
View Full Code Here

   
        edGen.addKeyTransRecipient(_reciCert);
   
        bOut = new ByteArrayOutputStream();
       
        out = edGen.open(bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
   
        BufferedOutputStream bfOut = new BufferedOutputStream(out, 300);
       
        for (int i = 0; i != 2000; i++)
        {
View Full Code Here

   
        edGen.addKeyTransRecipient(_reciCert);
   
        ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
       
        OutputStream out = edGen.open(
                                bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
   
        for (int i = 0; i != 2000; i++)
        {
            out.write(data[i]);
View Full Code Here

       
        edGen.addKeyTransRecipient(_reciCert);
   
        bOut = new ByteArrayOutputStream();
       
        out = edGen.open(bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
   
        for (int i = 0; i != 2000; i++)
        {
            out.write(data[i]);
        }
View Full Code Here

   
        edGen.addKeyTransRecipient(_reciCert);
   
        ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
       
        OutputStream out = edGen.open(
                                bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
   
        for (int i = 0; i != 2000; i++)
        {
            out.write(data[i]);
View Full Code Here

       
        edGen.addKeyTransRecipient(_reciCert);
   
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
       
        OutputStream out = edGen.open(bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
   
        for (int i = 0; i != data.length; i++)
        {
            out.write(data[i]);
        }
View Full Code Here

   
        edGen.addKeyTransRecipient(_reciCert);
   
        ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
       
        OutputStream out = edGen.open(
                                bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
   
        out.write(data);
       
        out.close();
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.