利用RSA-Tool和Big Integer Calculator工具解密

目录

 

目的:

内容

器材(设备、元器件)

步骤

1.打开RSA-tool

3.打开Big Integer Calculator


  • 目的:

利用工具完成解密计算

  • 内容

已知n、e和密文 求明文

  • 器材(设备、元器件)

RSA-Tool、Big Integ

  • 步骤

已知n、e和密文 求明文

解题链接: http://ctf5.shiyanbar.com/crypto/RSAROLL.txt

n=920139713,e=19 ,flag格式:flag{xxx}

 

解题思路:先计算d=d = e^-1 mod(p-1)(q-1),计算d之前分解n

                有了d就用公式   m=c^d mod n  解密

1.打开RSA-tool

输入n和e,点击Factor N(分解),得到p,q

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1pob3VfWmlaaQ==,size_16,color_FFFFFF,t_70

2. 再点击Calc.D,获得d

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1pob3VfWmlaaQ==,size_16,color_FFFFFF,t_70

3.打开Big Integer Calculator

在Y、Z输入d和n。在X输入密文

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1pob3VfWmlaaQ==,size_16,color_FFFFFF,t_70

得到第一个密文的ASCII码。利用此方法对后面的密文进行解密。并对照ASCII表

watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1pob3VfWmlaaQ==,size_16,color_FFFFFF,t_70

 

704796792 :102 f 

752211152 :108 l

274704164 :97 a

18414022  :103 g

368270835 :123 {

483295235 :49 1

263072905 :51 3

459788476 :50 2

483295235 :49 1

459788476 :50 2

663551792 :106 j

475206804 :101 e

459788476 :50 2

428313374 :117 u

475206804 :101 e

459788476 :50 2

425392137 :56 8

704796792 :102 f

458265677 :121 y

341524652 :55 7

483295235 :49 1

534149509 :119 w

425392137 :56 8

428313374 :117 u

425392137 :56 8

341524652 :55 7

458265677 :121 y

263072905 :51 3

483295235 :49 1

828509797 :114 r

341524652 :55 7

425392137 :56 8

475206804 :101 e              

428313374 :117 u              

483295235 :49 1

475206804 :101 e              

459788476 :50 2

306220148 :125 }

 

flag{13212je2ue28fy71w8u87y31r78eu1e2}

 

 

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 5
    评论
RSA-Tool 2 Copyright ?2000-2002 by tE! [TMG] Introduction Please read this text carefully. This utility has been made for those who want to use the RSA public key algorithm in their own programs. It offers creation of strong keypairs and a nice integer factorization feature which makes use of several differnt factoring methods including the MPQS. It's possible to factor integers +256 bits in size but please keep in mind that this can take a *lot* of memory and time ! Thus it's not recommended to try factoring bigger numbers on slow machines with a few MB of physical Memory. Don't even think of trying to factor 512 bit numbers for example.. RSA-Tool 2 Features: - Secure keypair generation - Key test dialog - Support of multiple number bases - Auto base-conversion on select - Support of numbers up to 4096 Bits 1. About RSA RSA is a Public Key Cryptosystem developed in 1977 by Ronald Rivest, Adi Shamir and Leonard Adleman. Since 09-20-2000 the U.S. Patent #4,405,829 on this Algorithm EXPIRED! That means that the Algorithm is Public Domain now and can be used by everyone for free, even in commercial software. 2. Parameters P = 1st large prime number Q = 2nd large prime number (sizes of P and Q should not differ too much!) E = Public Exponent (a random number which must fulfil: GCD(E, (P-1)*(Q-1))==1) N = Public Modulus, the product of P and Q: N=P*Q D = Private Exponent: D=E^(-1) mod ((P-1)*(Q-1)) Parameters N and E are public whereas D is -private- and must NEVER be published! P and Q are not longer needed after keygeneration and should be destroyed. To obtain D from the public key (N, E) one needs to try splitting N in its both prime factors P and Q. For a large Modulus N (512 bit and more) with carefully chosen primefactors P and Q this is a very difficult problem. All the security of the RSA encryption scheme relies on that integer factorization problem (tough there's no mathematical proof for it). To fin
RSA-3072 加密和解密的实现可以使用 Python 中的 `cryptography` 库,而 AES128 加密和解密则可以使用 Python 中的 `pycryptodome` 库。 下面分别介绍如何使用这两个库实现加密和解密: 1. RSA-3072 加密和解密 ```python from cryptography.hazmat.primitives.asymmetric import rsa, padding from cryptography.hazmat.primitives import serialization, hashes # 生成 RSA 密钥对 private_key = rsa.generate_private_key( public_exponent=65537, key_size=3072, ) public_key = private_key.public_key() # 将密钥对序列化为 PEM 格式 private_key_pem = private_key.private_bytes( encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.PKCS8, encryption_algorithm=serialization.NoEncryption() ) public_key_pem = public_key.public_bytes( encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo ) # 加密明文 message = b"Hello, World!" ciphertext = public_key.encrypt( message, padding.OAEP( mgf=padding.MGF1(algorithm=hashes.SHA256()), algorithm=hashes.SHA256(), label=None ) ) # 解密密文 plaintext = private_key.decrypt( ciphertext, padding.OAEP( mgf=padding.MGF1(algorithm=hashes.SHA256()), algorithm=hashes.SHA256(), label=None ) ) ``` 2. AES128 加密和解密 ```python from Crypto.Cipher import AES from Crypto.Random import get_random_bytes # 生成随机密钥 key = get_random_bytes(16) # 加密明文 message = b"Hello, World!" cipher = AES.new(key, AES.MODE_EAX) ciphertext, tag = cipher.encrypt_and_digest(message) # 解密密文 decipher = AES.new(key, AES.MODE_EAX, nonce=cipher.nonce) plaintext = decipher.decrypt_and_verify(ciphertext, tag) ``` 需要注意的是,这两个库的安装方式如下: ``` pip install cryptography pip install pycryptodome ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

PP_L

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值