CMSSignedData s = gen.generate(msg, true, getCAToken().getProvider());
CMSSignedData s = gen.generate(msg, true, "BC");
    public byte[] createPKCS7(Certificate cert, boolean includeChain) throws SignRequestSignatureException {        // First verify that we signed this certificate        try {            if (cert != null)                cert.verify(getCAToken().getPublicKey(SecConst.CAKEYPURPOSE_CERTSIGN), getCAToken().getProvider());        } catch (Exception e) {            throw new SignRequestSignatureException("Cannot verify certificate in createPKCS7(), did I sign this?");        }        Collection chain = getCertificateChain();        ArrayList certList = new ArrayList();        if (cert != null) {            certList.add(cert);        }         if (includeChain) {            certList.addAll(chain);        }        try {            CMSProcessable msg = new CMSProcessableByteArray("EJBCA".getBytes());            CertStore certs = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList), "BC");            CMSSignedDataGenerator gen = new CMSSignedDataGenerator();            gen.addSigner(getCAToken().getPrivateKey(SecConst.CAKEYPURPOSE_CERTSIGN), (X509Certificate)getCACertificate(), CMSSignedDataGenerator.DIGEST_SHA1);            gen.addCertificatesAndCRLs(certs);            CMSSignedData s = gen.generate(msg, true, getCAToken().getProvider());            return s.getEncoded();        } catch (CATokenOfflineException e) {        	this.setStatus(SecConst.CA_OFFLINE);        	throw new javax.ejb.EJBException(e);        	        } catch (Exception e) {            throw new javax.ejb.EJBException(e);        }       }    