Examples of RecipientInformation


Examples of org.bouncycastle.cms.RecipientInformation

               
                    Iterator recipientCertificatesIt =
                        data.getRecipientInfos().getRecipients().iterator();
           
                    while (recipientCertificatesIt.hasNext()) {
                        RecipientInformation recipientInfo =
                            (RecipientInformation)recipientCertificatesIt.next();

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

Examples of org.bouncycastle.cms.RecipientInformation

                byte[] recipientBytes = recipientFieldString.getBytes();
                CMSEnvelopedData data = new CMSEnvelopedData(recipientBytes);
                Iterator recipCertificatesIt = data.getRecipientInfos().getRecipients().iterator();
                while(recipCertificatesIt.hasNext())
                {
                    RecipientInformation ri =
                        (RecipientInformation)recipCertificatesIt.next();
                    // Impl: if a matching certificate was previously found it is an error,
                    // here we just don't care about it
                    if(ri.getRID().match(material.getCertificate()) && !foundRecipient)
                    {
                        foundRecipient = true;
                        envelopedData = ri.getContent(material.getPrivateKey(), "BC");           
                    }
                }
                recipientFieldsBytes[i] = recipientBytes;
                recipientFieldsLength += recipientBytes.length;
            }
View Full Code Here

Examples of org.bouncycastle.cms.RecipientInformation

                CMSEnvelopedData data = new CMSEnvelopedData(recipientBytes);
                Iterator<?> recipCertificatesIt = data.getRecipientInfos().getRecipients().iterator();
                int j = 0;
                while (recipCertificatesIt.hasNext())
                {
                    RecipientInformation ri = (RecipientInformation) recipCertificatesIt.next();
                    // Impl: if a matching certificate was previously found it is an error,
                    // here we just don't care about it
                    X509Certificate certificate = material.getCertificate();
                    X509CertificateHolder materialCert = null;
                    if (null != certificate)
                    {
                        materialCert = new X509CertificateHolder(certificate.getEncoded());
                    }
                    RecipientId rid = ri.getRID();
                    if (rid.match(materialCert) && !foundRecipient)
                    {
                        foundRecipient = true;
                        PrivateKey privateKey = (PrivateKey) material.getPrivateKey();
                        envelopedData = ri.getContent(new JceKeyTransEnvelopedRecipient(privateKey).setProvider("BC"));
                        break;
                    }
                    j++;
                    if ((verbose || LOG.isDebugEnabled()) && certificate != null)
                    {
View Full Code Here

Examples of org.bouncycastle.cms.RecipientInformation

                    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 = PdfEncryptor.getContent(recipientInfo, (PrivateKey)certificateKey, certificateKeyProvider);
                          foundRecipient = true;
                        }
                    }
View Full Code Here

Examples of org.bouncycastle.cms.RecipientInformation

                byte[] recipientBytes = recipientFieldString.getBytes();
                CMSEnvelopedData data = new CMSEnvelopedData(recipientBytes);
                Iterator recipCertificatesIt = data.getRecipientInfos().getRecipients().iterator();
                while(recipCertificatesIt.hasNext())
                {
                    RecipientInformation ri =
                        (RecipientInformation)recipCertificatesIt.next();
                    // Impl: if a matching certificate was previously found it is an error,
                    // here we just don't care about it
                    if(ri.getRID().match(material.getCertificate()) && !foundRecipient)
                    {
                        foundRecipient = true;
                        envelopedData = ri.getContent(material.getPrivateKey(), "BC");
                        break;
                    }
                }
                recipientFieldsBytes[i] = recipientBytes;
                recipientFieldsLength += recipientBytes.length;
View Full Code Here

Examples of org.bouncycastle.cms.RecipientInformation

        CMSEnvelopedData ed = new CMSEnvelopedData(resp);
        RecipientInformationStore  recipients = ed.getRecipientInfos();
        RecipientId id = new RecipientId();
        id.setIssuer(getCMSCertificate().getIssuerX500Principal());
        id.setSerialNumber(getCMSCertificate().getSerialNumber());
        RecipientInformation recipient = recipients.get(id);
        if (recipient != null) {
          resp = recipient.getContent(this.privKey, "BC");
        }
      }
      returnval = new CmsCAServiceResponse(resp);
    } catch (InvalidAlgorithmParameterException e) {
          m_log.error("Error in CmsCAService", e);
View Full Code Here

Examples of org.bouncycastle.cms.RecipientInformation

        Collection c = recipients.getRecipients();
        Iterator it = c.iterator();
        byte[] decBytes = null;

        while (it.hasNext()) {
            RecipientInformation recipient = (RecipientInformation) it.next();
            log.debug("Privatekey : " + privateKey.getAlgorithm());
            decBytes = recipient.getContent(privateKey, jceProvider);
            break;
        }

        DERObject derobj = new ASN1InputStream(new ByteArrayInputStream(decBytes)).readObject();
        if (messageType == ScepRequestMessage.SCEP_TYPE_PKCSREQ) {
View Full Code Here

Examples of org.bouncycastle.cms.RecipientInformation

    try{
      CMSEnvelopedData ed = new CMSEnvelopedData(encData);          
     
      RecipientInformationStore  recipients = ed.getRecipientInfos();            
      Iterator    it =  recipients.getRecipients().iterator();
      RecipientInformation   recipient = (RecipientInformation) it.next();     
      retdata = recipient.getContent(decKey, provider);
    } catch(Exception e){
      log.error("Error decypting data : ", e);
    }
                 
      return retdata; 
View Full Code Here

Examples of org.bouncycastle.cms.RecipientInformation

              // within the CMS signed data
              final CMSProcessable sp = s.getSignedContent();
              final byte content[] = (byte[])sp.getContent();
              final CMSEnvelopedData ed = new CMSEnvelopedData(content);
              final RecipientInformationStore recipients = ed.getRecipientInfos();
              final RecipientInformation recipient;
              {
                final Collection<?> c = recipients.getRecipients();
                if ( c.size() != 1 ) {
                  StressTest.this.performanceTest.getLog().error("recipients should be 1: "+c.size());
                  return false;
                }
                final Iterator<?> it = c.iterator();
                recipient = (RecipientInformation) it.next();
              }
              final byte decBytes[] = recipient.getContent(StressTest.this.keyPair.getPrivate(), "BC");
              // This is yet another CMS signed data
              final CMSSignedData sd = new CMSSignedData(decBytes);
              // Get certificates from the signed data
              final CertStore certstore = sd.getCertificatesAndCRLs("Collection","BC");
              if (crlRep) {
View Full Code Here

Examples of org.bouncycastle.cms.RecipientInformation

            {
                Collection<RecipientInformation> c = recipients.getRecipients();
                assertEquals(c.size(), 1);
                Iterator<RecipientInformation> it = c.iterator();
                byte[] decBytes = null;
                RecipientInformation recipient = it.next();
                decBytes = recipient.getContent(key1.getPrivate(), "BC");
                // This is yet another CMS signed data
                CMSSignedData sd = new CMSSignedData(decBytes);
                // Get certificates from the signed data
                certstore = sd.getCertificatesAndCRLs("Collection", "BC");
            }
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.