Package org.bouncycastle.cms

Examples of org.bouncycastle.cms.SignerInformationStore


     * @return CMSSignedData - Extended CMS signed data
     */
    private CMSSignedData signTimeStamps(CMSSignedData signedData)
            throws IOException, TSPException
    {
        SignerInformationStore signerStore = signedData.getSignerInfos();
        List<SignerInformation> newSigners = new ArrayList<SignerInformation>();

        for (SignerInformation signer : (Collection<SignerInformation>)signerStore.getSigners())
        {
            newSigners.add(signTimeStamp(signer));
        }

        // TODO do we have to return a new store?
        return CMSSignedData.replaceSigners(signedData, new SignerInformationStore(newSigners));
    }
View Full Code Here


    private void init() throws IOException {
        log.trace(">init");

        try {
            CMSSignedData csd = new CMSSignedData(scepmsg);
            SignerInformationStore infoStore = csd.getSignerInfos();
            Collection signers = infoStore.getSigners();
            Iterator iter = signers.iterator();
            if (iter.hasNext()) {
              SignerInformation si = (SignerInformation)iter.next();
              preferredDigestAlg = si.getDigestAlgOID();
              log.debug("Set "+ preferredDigestAlg+" as preferred digest algorithm for SCEP");
View Full Code Here

            }

            CertStore certs = signedData.getCertificatesAndCRLs("Collection",
                    "BC");

            SignerInformationStore  signers = signedData.getSignerInfos();
            for (Object o : signers.getSigners()) {
                if (o instanceof SignerInformation) {
                    SignerInformation si = (SignerInformation) o;

                    if (LOG.isDebugEnabled()) {
                        LOG.debug("*** SIGNATURE: " + "\n" + si.getSID());
View Full Code Here

        assertNotNull(resp);
        byte[] respdoc = resp.getCmsDocument();
        assertNotNull(resp);
        CMSSignedData csd = new CMSSignedData(respdoc);
        SignerInformationStore infoStore = csd.getSignerInfos();
        Collection<SignerInformation> signers = infoStore.getSigners();
        Iterator<SignerInformation> iter = signers.iterator();
        if (iter.hasNext()) {
            SignerInformation si = iter.next();
            assertNotNull(si);
            // log.info("Digest alg is: "+si.getDigestAlgOID());
View Full Code Here

    // Check the pkcs7 response
    byte[] pkcs7 = resp.getCertificateAsPKCS7();
    assertNotNull(pkcs7);
        CMSSignedData s = new CMSSignedData(pkcs7);
        // The signer, i.e. the CA, check it's the right CA
        SignerInformationStore signers = s.getSignerInfos();
        Collection col = signers.getSigners();
        assertTrue(col.size() > 0);
        Iterator siter = col.iterator();
        SignerInformation signerInfo = (SignerInformation)siter.next();
        SignerId sinfo = signerInfo.getSID();
        // Check that the signer is the expected CA
View Full Code Here

    // Check the pkcs7 response
    byte[] pkcs7 = resp.getCertificateAsPKCS7();
    assertNotNull(pkcs7);
        CMSSignedData s = new CMSSignedData(pkcs7);
        // The signer, i.e. the CA, check it's the right CA
        SignerInformationStore signers = s.getSignerInfos();
        Collection col = signers.getSigners();
        assertTrue(col.size() > 0);
        Iterator siter = col.iterator();
        SignerInformation signerInfo = (SignerInformation)siter.next();
        SignerId sinfo = signerInfo.getSID();
        // Check that the signer is the expected CA
View Full Code Here

    response = response.replaceFirst("-----BEGIN PKCS7-----", "").replaceFirst("-----END PKCS7-----", "");
    byte[] responseData = Base64.decode(response.getBytes());
    X509Certificate returnCertificate= null;
    CMSSignedData p7b = new CMSSignedData(responseData);
    CertStore certStore = p7b.getCertificatesAndCRLs("Collection", "BC");
    SignerInformationStore  signers = p7b.getSignerInfos();
    Iterator<SignerInformation> iter = signers.getSigners().iterator();
    while (iter.hasNext())
    {
      SignerInformation signer = iter.next();
      X509Certificate caCert = (X509Certificate) certStore.getCertificates(signer.getSID()).iterator().next();
      Iterator<? extends Certificate> iter2 = certStore.getCertificates(null).iterator();
View Full Code Here

        try{
          // First verify the signature
          CMSSignedData     sp = new CMSSignedData(signedData);                                 
         
          CertStore               certs = sp.getCertificatesAndCRLs("Collection", "BC");
          SignerInformationStore  signers = sp.getSignerInfos();
         
          ByteArrayOutputStream baos = new ByteArrayOutputStream();         
          ((CMSProcessableByteArray) sp.getSignedContent()).write(baos);
          content = baos.toByteArray();
          baos.close();
         
          Collection              c = signers.getSigners();
          Iterator                it = c.iterator();
         
          while (it.hasNext())
          {
            SignerInformation   signer = (SignerInformation)it.next();
View Full Code Here

              //
              // Parse response message
              //
              CMSSignedData s = new CMSSignedData(retMsg);
              // The signer, i.e. the CA, check it's the right CA
              SignerInformationStore signers = s.getSignerInfos();
              Collection<?> col = signers.getSigners();
              if ( col.size() <= 0 ) {
                StressTest.this.performanceTest.getLog().error("Signers can not be 0");
                return false;
              }
              Iterator<?> iter = col.iterator();
View Full Code Here

            private boolean isScepResponseMessageOfType(byte[] retMsg, ResponseStatus extectedResponseStatus) throws CMSException {
                //
                // Parse response message
                //
                CMSSignedData s = new CMSSignedData(retMsg);
                SignerInformationStore signers = s.getSignerInfos();
                Collection<?> col = signers.getSigners();
                Iterator<?> iter = col.iterator();
                SignerInformation signerInfo = (SignerInformation)iter.next();
                // Get authenticated attributes
                AttributeTable tab = signerInfo.getSignedAttributes();       
                Attribute attr = tab.get(new DERObjectIdentifier(ScepRequestMessage.id_pkiStatus));
View Full Code Here

TOP

Related Classes of org.bouncycastle.cms.SignerInformationStore

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.