如何使用RSA解密给定私钥的密文?

时间:2018-12-29 23:40:17

标签: encryption rsa private-key

我有这个私钥,我正在尝试解密密文:

x = x_origin + Math.sin(angle) * radius;
y = y_origin + Math.cos(angle) * radius;

密文

-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAkfmJTVkwbRXOtWN76j2MAmbwCMReCkV3hWG+23zEmivwVEUtlUNvmFkSx9fFSRgGLMW+TPleLybU629fYDTXSPmIzLM3faxIyzyI2LJdRAaQMWo1FUcVI8ME5/BX9T5Ebu6D2dA8zJzJ68dGkHmhSxhOC97vLQfjj3tNCAL1IulyVk/ZyV6BVPxpiD3WB4rfo+SBe8H7019+dnaR/DcTcCsxF+oj7KOunfPPqBZBGMRe7ADj/vPYqgpoTWyA8m0juJyVNjqBnFUeyZEPwjqYUKEXpw64YXDZH/hbJI6VaFmj/KpMzBv/gIowE+yOu1V5tsOSCqDsd6EgDfQU92FhpwIDAQABAoIBAEkkZb3SAMfH84lDzeUy7aKOfZuG+S/gWuEEdyN3QvOVLJitCQgPgC0wBI8J+JqFZSKt+oqLMLwjkvBdH8cO8whnsDoRWq6n0tmy/UbHKKBbQYjhFLQSp+8BWsX00b3ac2O6M2rCQpSrwylW8m6V41HDXefozqMbntRYDeMDyFyzJnto2nBJ4sM7esiSIhERUeXlz8QHmxn0Ay3j8LnSBtCKdZ3nAQ19No6naRu7IbrMGbqWnzxiWa5PqJa1gF9wMMHI0Vfz6lT6x/qT5nYPORRxakuuUg9BmwJmhElOZqf/tC3YCcrGOfq04u+AS+S2GE7C2yOAfhX15HgP8FeiEdECgYEAu1vMVNMRrjbkLF4wBJ4tOVDylDEU9/quuzK21JVKEePZJP/gK2O+1nO9xGGfFRtnBeDnz7mgLuD04lnRZnSFfE+S3WDcb94hkJl0K00Z2sGIPvSR7S5853kua591QT6QNhTDP8PUdIGrSZBFJ+DyZgdBdlcxOiNh0nWzIFbWnx0CgYEAx3RiM3ySvsb7ZOg3/RMWD4r33rb3DRiDoa5PObNtqesbqYU5BOUl3IQY86kYwLQttgrcgb9xtTmBXS0rcWSAa3ndXdULujRIwK3IaJTz98Pu9iAzj8RNIFk9Sw9kUzmAHaSzXgZcjf9c5lL7jgrwjEfYeKvgkW1VoIb9lKng1JMCgYBE8AgFBgyxX30hXh6o9FKLjl9Ta6Pdgp2cP5LKMYwpfP6/AG9JR9BGNBwVEB5qs8R6g0CITDLGTPuN9aJ44lLjZJwTXLp/ZupOvEfkTuA+f4tULsUq0jofKZWNAAUy1oRVgdo9sh6QJ84QqUbo33oRVIYftwFj9PTfbXNVaN5beQKBgC/vudZT/1TYr/ztjt9FIg00QiSF5tR/6ssGAMaGaDnpZqmUekLB7BqWqQSOxIM0CrRw4dRRNbvviTbir0k+dVrfXCO8G2hyPnYIjl0MR6JptdnznVDVRhAbQo7ysRMLg84cEnvrnX0HPcWhdhIKcQvWDKHb9Uoec/Dz4KhFN+L/AoGATnaM4pl/tv735KcNn+qpgyB2Qd01qasRahecchPZqujH0+roS3llDJFN09NG9BzmAQFi2yH7Asx5KmIHqyWiYqyMXGUcsauT3u+xsDYWxObqAW7q7sMCKlfRtsnEWli3FOWNufO0TBwGeL9xVjL3nXXIsD9J5/iq1cH/RuIVoX4=
-----END RSA PRIVATE KEY-----

我尝试使用这些命令但没有成功:

M8zhAvxu/lkEcH42Eoe/cPjL6WJwPo1FZOK8Ta4SmigoHl9omd5Dol84vY3GfyzIZ0hHHp5gO3A4MjktImsLnT3Xx/myUearG/Ii24C+6irFapMqghziuMDYpeh7rs8G8ggE/rkjZaAAPSb/FgEDQkknL2qr4kxwyQybsnfmDDUqJ3q3lf0gRBDJ/2yr+aQyUcw3nK/zewbZjwlUeSyTvs76HhFtUDTyAlhB37961j9qfu+cxX34PtJlHWlF7k0WAuxQ4w7aCwkuQIvBOk/FUK3Ta1TrGEXg9iczPj6QacLI2DSjEPbODHsje82Fw+1ylcD1tF2mZ7GnnqtUw/9YoQ==

在这种情况下,我得到了休闲错误:

rsa例程:RSA_EAY_PRIVATE_DECRYPT:数据大于mod len:rsa_eay.c:518

openssl rsautl -decrypt -in ciphertext -out plaintext -inkey private_key

如果我尝试这2条命令,则会出现此错误:

rsa例程:RA_padding_check_PKCS1_type_2:pkcs解码错误

rsa例程:RSA_EAY_PRIVATE_DECRYPT:填充检查失败

0 个答案:

没有答案