rsa解密


    给了flag.en和rsa_private_key.pem私钥,直接用openssl解密,得到flag{We1c0meCtf3r_elab}
    易霖博CTF-easyRSA - 图1

    也可用python解密:

    1. import rsa
    2. def decrypt(crypt_text): # 用私钥解密
    3. with open('rsa_private_key.pem', 'rb') as privatefile:
    4. p = privatefile.read()
    5. privkey = rsa.PrivateKey.load_pkcs1(p)
    6. lase_text = rsa.decrypt(crypt_text, privkey).decode()
    7. print(lase_text)
    8. if __name__ == '__main__':
    9. with open('flag.en', 'rb') as publickfile:
    10. p = publickfile.read()
    11. lase_text = decrypt(p)