def create(recipients, data, cipher, flags=0):
        """
        Creates and encrypts message
        @param recipients - list of X509 objects
        @param data - contents of the message
        @param cipher - CipherType object
        @param flags - flag
        """
        recp = StackOfX509(recipients)
        bio = Membio(data)
        cms_ptr = libcrypto.CMS_encrypt(recp.ptr, bio.bio, cipher.cipher,
                                        flags)
        if cms_ptr is None:
            raise CMSError("encrypt EnvelopedData")
        return EnvelopedData(cms_ptr)