6 if env
.has_key('PYTHON_KEYFILE'):
7 keyfile
= env
['PYTHON_KEYFILE']
9 keyfile
= '.python_keyfile'
10 if env
.has_key('HOME'):
11 keyfile
= os
.path
.join(env
['HOME'], keyfile
)
12 if not os
.path
.exists(keyfile
):
15 kf
= os
.path
.join(dir, keyfile
)
16 if os
.path
.exists(kf
):
20 self
._key
= eval(open(keyfile
).readline())
22 raise IOError, "python keyfile %s: cannot open" % keyfile
24 def _generate_challenge(self
):
26 return random
.randint(100, 100000)
28 def _compare_challenge_response(self
, challenge
, response
):
29 return self
._encode
_challenge
(challenge
) == response
31 def _encode_challenge(self
, challenge
):
33 return pow(long(challenge
), p
, m
)