new CMSProcessableByteArray(baos.toByteArray()), CMSEnvelopedDataGenerator.AES256_CBC, getCAToken().getProvider());
new CMSProcessableByteArray(baos.toByteArray()), CMSEnvelopedDataGenerator.AES256_CBC,"BC");
    public byte[] encryptKeys(KeyPair keypair) throws IOException, CATokenOfflineException{        	ByteArrayOutputStream baos = new ByteArrayOutputStream();    	ObjectOutputStream os = new ObjectOutputStream(baos);    	os.writeObject(keypair);    	        	    	CertTools.installBCProvider();    		        CMSEnvelopedDataGenerator edGen = new CMSEnvelopedDataGenerator();    	    	    	    	                 	CMSEnvelopedData ed;		try {			edGen.addKeyTransRecipient( this.getCAToken().getPublicKey(SecConst.CAKEYPURPOSE_KEYENCRYPT), this.keyId);			ed = edGen.generate(					new CMSProcessableByteArray(baos.toByteArray()), CMSEnvelopedDataGenerator.AES256_CBC,					              getCAToken().getProvider());		} catch (CATokenOfflineException ctoe) {			this.setStatus(SecConst.CA_OFFLINE);          	throw ctoe;	 			} catch (Exception e) {            setStatus(SecConst.CA_OFFLINE);            log.error("-encryptKeys: ", e);            throw new IOException(e.getMessage());        		}								return ed.getEncoded();     }