def pack(self, req, receiver='', iss='', lifetime=0, sign=True,
             sign_alg='', encrypt=False, enc_enc="A128CBC-HS256",
             enc_alg="RSA1_5", aud=None):
        """

        :param req: Original metadata statement as a 
            :py:class:`MetadataStatement` instance
        :param receiver: The immediate receiver of the JWS
        :param iss:
        :param lifetime:
        :param sign:
        :param sign_alg:
        :param encrypt:
        :param enc_alg:
        :param enc_enc:
        :param aud: The audience, a list of receivers.
        :return: A dictionary with a signed JWT as value with the key 'sms'
        """
        if not iss:
            iss = self.iss
        if not lifetime:
            lifetime = self.lifetime

        keyjar = self.keyjar

        # Own copy
        _metadata = copy.deepcopy(req)
        if self.add_ons:
            _metadata.update(self.add_ons)

        args = {}
        if sign:
            if sign_alg:
                args['sign_alg'] = sign_alg
            else:
                args['sign_alg'] = self.alg
        if encrypt:
            args['enc_enc'] = enc_enc
            args['enc_alg'] = enc_alg

        _jwt = JWT(keyjar, iss=iss, msg_cls=_metadata.__class__,
                   lifetime=lifetime, **args)
        # _jwt.sign_alg = self.alg

        if iss in keyjar.issuer_keys:
            owner = iss
        else:
            owner = ''

        return _jwt.pack(payload=_metadata.to_dict(), owner=owner,
                         recv=receiver, aud=aud)
def pack ( self , req , receiver = '' , iss = '' , lifetime = 0 , sign = True , sign_alg = '' , encrypt = False , enc_enc = "A128CBC-HS256" , enc_alg = "RSA1_5" , aud = None ) : if not iss : iss = self . iss if not lifetime : lifetime = self . lifetime keyjar = self . keyjar _metadata = copy . deepcopy ( req ) if self . add_ons : _metadata . update ( self . add_ons ) args = { } if sign : if sign_alg : args [ 'sign_alg' ] = sign_alg else : args [ 'sign_alg' ] = self . alg if encrypt : args [ 'enc_enc' ] = enc_enc args [ 'enc_alg' ] = enc_alg _jwt = JWT ( keyjar , iss = iss , msg_cls = _metadata . __class__ , lifetime = lifetime , ** args ) if iss in keyjar . issuer_keys : owner = iss else : owner = '' return _jwt . pack ( payload = _metadata . to_dict ( ) , owner = owner , recv = receiver , aud = aud )
:param req: Original metadata statement as a 
            :py:class:`MetadataStatement` instance
        :param receiver: The immediate receiver of the JWS
        :param iss:
        :param lifetime:
        :param sign:
        :param sign_alg:
        :param encrypt:
        :param enc_alg:
        :param enc_enc:
        :param aud: The audience, a list of receivers.
        :return: A dictionary with a signed JWT as value with the key 'sms'