def create(data, cert, pkey, flags=Flags.BINARY, certs=None):
        """
            Creates SignedData message by signing data with pkey and
            certificate.

            @param data - data to sign
            @param cert - signer's certificate
            @param pkey - pkey object with private key to sign
            @param flags - OReed combination of Flags constants
            @param certs - list of X509 objects to include into CMS
        """
        if not pkey.cansign:
            raise ValueError("Specified keypair has no private part")
        if cert.pubkey != pkey:
            raise ValueError("Certificate doesn't match public key")
        bio = Membio(data)
        if certs is not None and len(certs) > 0:
            certstack_obj = StackOfX509(certs)  # keep reference to prevent immediate __del__ call
            certstack = certstack_obj.ptr
        else:
            certstack = None
        ptr = libcrypto.CMS_sign(cert.cert, pkey.key, certstack, bio.bio, flags)
        if ptr is None:
            raise CMSError("signing message")
        return SignedData(ptr)
def create ( data , cert , pkey , flags = Flags . BINARY , certs = None ) : if not pkey . cansign : raise ValueError ( "Specified keypair has no private part" ) if cert . pubkey != pkey : raise ValueError ( "Certificate doesn't match public key" ) bio = Membio ( data ) if certs is not None and len ( certs ) > 0 : certstack_obj = StackOfX509 ( certs ) certstack = certstack_obj . ptr else : certstack = None ptr = libcrypto . CMS_sign ( cert . cert , pkey . key , certstack , bio . bio , flags ) if ptr is None : raise CMSError ( "signing message" ) return SignedData ( ptr )
Creates SignedData message by signing data with pkey and
            certificate.

            @param data - data to sign
            @param cert - signer's certificate
            @param pkey - pkey object with private key to sign
            @param flags - OReed combination of Flags constants
            @param certs - list of X509 objects to include into CMS