예제 #1
0
def sign_digest(digest, keypath):
    baseconv = BaseConverter('0123456789abcdef')
    key = load_RSA(keypath)
    try:
        return baseconv.from_decimal(key.sign(digest, "")[0])
    except:
        logger.exception("Unable to sign MD5 hash digest with RSA.")
        return ''
예제 #2
0
def solve_challenge(challenge, keypath):
    baseconv = BaseConverter('0123456789abcdef')
    key = load_RSA(keypath)
    if key:
        try:
            signature = key.sign(challenge, "")
            sig_encoded = baseconv.from_decimal(signature[0])
        except :
            logger.exception("Unable to sign challenge with RSA.")
            return ''
    else:
        return ''
    return sig_encoded