Package org.bouncycastle.cms

Examples of org.bouncycastle.cms.RecipientInformation


        Key                 priKey = keyFact.generatePrivate(keySpec);
        byte[]              data = Hex.decode("57616c6c6157616c6c6157617368696e67746f6e");

        while (it.hasNext())
        {
            RecipientInformation   recipient = (RecipientInformation)it.next();

            assertEquals(recipient.getKeyEncryptionAlgOID(), PKCSObjectIdentifiers.rsaEncryption.getId());
           
            CMSTypedStream recData = recipient.getContentStream(priKey, "BC");
           
            assertEquals(true, Arrays.equals(data, CMSTestUtil.streamToByteArray(recData.getContentStream())));
        }
    }
View Full Code Here


        Collection  c = recipients.getRecipients();
        Iterator    it = c.iterator();
       
        while (it.hasNext())
        {
            RecipientInformation   recipient = (RecipientInformation)it.next();
   
            assertEquals(recipient.getKeyEncryptionAlgOID(), PKCSObjectIdentifiers.rsaEncryption.getId());
           
            CMSTypedStream recData = recipient.getContentStream(_reciKP.getPrivate(), "BC");
           
            assertEquals(true, Arrays.equals(expectedData, CMSTestUtil.streamToByteArray(recData.getContentStream())));
        }
    }
View Full Code Here

        Collection                 c = recipients.getRecipients();
        Iterator                   it = c.iterator();
       
        if (it.hasNext())
        {
            RecipientInformation   recipient = (RecipientInformation)it.next();
   
            assertEquals(recipient.getKeyEncryptionAlgOID(), PKCSObjectIdentifiers.rsaEncryption.getId());
           
            CMSTypedStream recData = recipient.getContentStream(_reciKP.getPrivate(), "BC");
           
            InputStream           dataStream = recData.getContentStream();
            ByteArrayOutputStream dataOut = new ByteArrayOutputStream();
            int                   len;
            byte[]                buf = new byte[BUFFER_SIZE];
View Full Code Here

        Collection  c = recipients.getRecipients();
        Iterator    it = c.iterator();
       
        while (it.hasNext())
        {
            RecipientInformation   recipient = (RecipientInformation)it.next();
   
            assertEquals(recipient.getKeyEncryptionAlgOID(), PKCSObjectIdentifiers.rsaEncryption.getId());
           
            CMSTypedStream recData = recipient.getContentStream(_reciKP.getPrivate(), "BC");
           
            assertEquals(true, Arrays.equals(data, CMSTestUtil.streamToByteArray(recData.getContentStream())));
        }
       
        ep.close();
View Full Code Here

        Collection  c = recipients.getRecipients();
        Iterator    it = c.iterator();
       
        while (it.hasNext())
        {
            RecipientInformation   recipient = (RecipientInformation)it.next();

            assertEquals(recipient.getKeyEncryptionAlgOID(), PKCSObjectIdentifiers.rsaEncryption.getId());
           
            CMSTypedStream recData = recipient.getContentStream(_reciKP.getPrivate(), "SunJCE");
           
            assertEquals(true, Arrays.equals(data, CMSTestUtil.streamToByteArray(recData.getContentStream())));
        }
       
        ep.close();
View Full Code Here

        Collection  c = recipients.getRecipients();
        Iterator    it = c.iterator();

        while (it.hasNext())
        {
            RecipientInformation   recipient = (RecipientInformation)it.next();

            assertEquals(recipient.getKeyEncryptionAlgOID(), "2.16.840.1.101.3.4.1.25");
           
            CMSTypedStream recData = recipient.getContentStream(kek, "BC");
           
            assertEquals(true, Arrays.equals(data, CMSTestUtil.streamToByteArray(recData.getContentStream())));
        }
       
        ep.close();
View Full Code Here

       
        RecipientId                recSel = new RecipientId();
       
        recSel.setKeyIdentifier(kekId2);
       
        RecipientInformation       recipient = recipients.get(recSel);
       
        assertEquals(recipient.getKeyEncryptionAlgOID(), "2.16.840.1.101.3.4.1.25");
       
        CMSTypedStream recData = recipient.getContentStream(kek2, "BC");
       
        assertEquals(true, Arrays.equals(data, CMSTestUtil.streamToByteArray(recData.getContentStream())));

        ep.close();
    }
View Full Code Here

        RecipientId                recSel = new RecipientId();

        recSel.setIssuer(PrincipalUtil.getIssuerX509Principal(_reciEcCert).getEncoded());
        recSel.setSerialNumber(_reciEcCert.getSerialNumber());

        RecipientInformation       recipient = recipients.get(recSel);

        CMSTypedStream recData = recipient.getContentStream(_reciEcKP.getPrivate(), "BC");

        assertEquals(true, Arrays.equals(data, CMSTestUtil.streamToByteArray(recData.getContentStream())));

        ep.close();
    }
View Full Code Here

        Iterator    it = c.iterator();

        while (it.hasNext())
        {
            RecipientInformation recipient = (RecipientInformation)it.next();

            assertEquals(recipient.getKeyEncryptionAlgOID(), PKCSObjectIdentifiers.rsaEncryption.getId());

            byte[] recData = recipient.getContent(keyPair.getPrivate(), null);

            assertEquals(true, Arrays.equals(data, recData));
        }
    }
View Full Code Here

                    data = new CMSEnvelopedData(recipient.getBytes());

                    Iterator<RecipientInformation> recipientCertificatesIt = data.getRecipientInfos().getRecipients().iterator();

                    while (recipientCertificatesIt.hasNext()) {
                        RecipientInformation recipientInfo = recipientCertificatesIt.next();

                        if (recipientInfo.getRID().match(certificate) && !foundRecipient) {
                         envelopedData = recipientInfo.getContent(certificateKey, certificateKeyProvider);
                         foundRecipient = true;
                        }
                    }
                }
                catch (Exception f) {
View Full Code Here

TOP

Related Classes of org.bouncycastle.cms.RecipientInformation

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.