'@param message: The associate request message
@type message: openid.message.Message
@returntype: L{DiffieHellmanSHA1ServerSession}
@raises ProtocolError: When parameters required to establish the
session are missing.'

def fromMessage(cls, message):

    dh_modulus = message.getArg(OPENID_NS, 'dh_modulus')
    dh_gen = message.getArg(OPENID_NS, 'dh_gen')
    if (((dh_modulus is None) and (dh_gen is not None)) or ((dh_gen is None) and (dh_modulus is not None))):
        if (dh_modulus is None):
            missing = 'modulus'
        else:
            missing = 'generator'
        raise ProtocolError(message, ('If    non-default    modulus    or    generator    is    supplied,    both    must    be    supplied.    Missing    %s' % (missing,)))
    if (dh_modulus or dh_gen):
        dh_modulus = cryptutil.base64ToLong(dh_modulus)
        dh_gen = cryptutil.base64ToLong(dh_gen)
        dh = DiffieHellman(dh_modulus, dh_gen)
    else:
        dh = DiffieHellman.fromDefaults()
    consumer_pubkey = message.getArg(OPENID_NS, 'dh_consumer_public')
    if (consumer_pubkey is None):
        raise ProtocolError(message, ('Public    key    for    DH-SHA1    session    not    found    in    message    %s' % (message,)))
    consumer_pubkey = cryptutil.base64ToLong(consumer_pubkey)
    return cls(dh, consumer_pubkey)
