Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excuse me, the long encrypted content cannot be decrypted because of the length problem. Is there a better solution at present? #17

Closed
kxy000 opened this issue Dec 27, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@kxy000
Copy link

kxy000 commented Dec 27, 2022

感谢提供优秀的功能。

目前有个小疑问,接收到其他较长RSA加密内容(其他人的接口返回,我无法让对方改变长度),无法解密,请问有什么好的方式吗?

比如

官方示例公钥 私钥 进行在线加解密没问题

-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAK12MTd84qkCZzp4iLUj8YSUglaFMsFlv9KlIL4+Xts40PK3+wbsXPEw
cujGeUmdgMeZiK7SLLSz8QeE0v7Vs+cGK4Bs4qLtMGCiO6wEuyt10KsafTyBktFn
dk/+gBLr7B/b+9+HaMIIoJUdsFksdAg3cxTSpwVApe98loFNRfqDAgMBAAE=
-----END RSA PUBLIC KEY-----

-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCtdjE3fOKpAmc6eIi1I/GElIJWhTLBZb/SpSC+Pl7bONDyt/sG
7FzxMHLoxnlJnYDHmYiu0iy0s/EHhNL+1bPnBiuAbOKi7TBgojusBLsrddCrGn08
gZLRZ3ZP/oAS6+wf2/vfh2jCCKCVHbBZLHQIN3MU0qcFQKXvfJaBTUX6gwIDAQAB
AoGAFwAfEo56t5JcAcLNzccQVVYj2jkbO820G8hNiSxYA5WLD0QaAxcAU/Lqqbb3
ii1aUB0ppJS13NgnU6nnGGdZzUYBG1Hai6EkVyCGrI4amQ93AaVdKncL8gJ4RZAm
YzPPUwSMEESsu24pS1NF1G1Y8C+28b/Wr0oqOsCvL6PhsMECQQDwsPJJoWRx7ZJw
E1K5KLT0cXKyrIpyXY3I6tyA5imCzOzccf3d1vDgB0L9sdSO7bG3ceSwpAeiWEbg
5jGZemPzAkEAuH6U4pEI4AMbWnatpK55Rc235NDgmT3VyIuRaKC02YXAZ+jznFep
XMd4DTli4R9r3j2YVhUpyDVbdQpFH98DMQJAQpOvcU6DSkA80WOG7lCkPTlkUKgJ
Y7kdDwZoF/+SW+vzWMbvQf3CgzV/Ak2+TgrRrbyDVZkJw45HjM4fyiRgoQJBALH/
/qlxgPyQQs3O/s2KQBsm1auAE5IF5MLuVUZ69sF/mBko2hEXSqHnGV645TuKU0pC
Zz12ga9WO3z6gaK0SaECQQDah1pKt9ViBBy4USXK3OWXEloHuTwmyr9AbLqqI5tQ
2eNuH0NkuJYQmnXmHLbKOELoYocldEBXmkzPXSN+X9kV
-----END RSA PRIVATE KEY-----

使用在线加密 https://the-x.cn/cryptography/Rsa.aspx 加密以下内容

{"resources":[{"url":"/s/d41d8cd98f00b204e9800998ecf8427e-CDN/-agee2g/8703/189cb2l/6996746284aaa1c092b08a6943f0127e/_/download/contextbatch/css/request-access-plugin,-_super/batch.css","resourceType":"CSS","ieOnly":false,"key":"request-access-plugin,-_super","batchType":"context"},{"url":"/s/53f60c417daf99ffbdbb9a3d8dc254c2-CDN/-agee2g/8703/189cb2l/6996746284aaa1c092b08a6943f0127e/_/download/contextbatch/js/request-access-plugin,-_super/batch.js?locale=zh-CN","resourceType":"JAVASCRIPT","ieOnly":false,"key":"request-access-plugin,-_super","batchType":"context"}],"unparsedData":{"com.atlassian.confluence.plugins.confluence-request-access-plugin:confluence-request-access-plugin-resources.mail-server-configured":"true"},"unparsedErrors":{}}

获取加密后的内容为:

C/B9BCapoSqo03jfJzk7QFTuQkWNVYrDioW9/Ud8+O3hj92fmYcNuXABQIjvZBVAtAqmo83uAQzxuE3eIrPe2rBTO06Y4VNK/+Vh7NH1gvpe+FGq+VoQha69S4F7pLk8mcTW2knLmVI8rlPz2C2DT9s+ZXKi6a8xmMs44/ZWCtpQSWmM/tWRdEumt7oj9E/zt+dBO3OKsM/9Am+ht2+UmH9LdfICFKHXG11UWfBwOxeqSUMK6Al3PVviE8JEdkbq6KqJQX0oYNkqmsYI+efStMndnJw9OeJudorHOzQjQtLROrNWyXIhTP/wajPPG3wmsNrKTn1WFLpcfWDQlT1Dt0mQqRP8FjnwNHTLwx1gtB7geLnO2sQFQph6XS1/XzhMV0qOztJKUNlxuOzY27Yst9opDeq0zcAPy+nGxdmWYp1a+8jAipzZ6zYn+pp6lY7MpDgpLdtXrAJDwt7zcdX6Bjwa+hXpJ5+4zSy4t7oo7ze+eqaFp4VR31hDNfWFU+dFTlH9R1g/2f2eOaWKn4yQzd9GNrz9D2MFQ1tx+IhbzZdnV0cGCMHLLk4DYMCmhh9o60RhOZO50CzBNctQlc4498qScwYlg3BQt0xmQDcodcUfsdtYC6EJRB3SsfAjmyNgcaDc9fUinF6uu5BdZIibutYfVsbpaf7haJ4WuzgYAfoRh8LVPm9l9ceM7iS38gLSWPv8IvyAjm6CwYU+KZABeWwaqHDubvdolIWd9GSjPWh9sw+JfA4F8nTbpgf9OegNS4hQUFvbR0NGg/R9/WoB4lTPOf2KSgdlxSzZtpSETvND1GrwI4So3XYa0t+MZBtBSnEwxQKwbiWhzPy4kM6s5S01XfrcpMIA9joVK8yhtQAH1FAZLHm+jIcQ1urhQ2CWvDWmsJZhL6KYL2GSi3q7XhgbMf3AT6Rpr0tDwsVOjkSnbxuobtpneGqCaj8w36Ixl+cy9ETH4q4P3bW6XjbnNzQbz6M94B4WvXnqA2YWJ+77SpEdIBZjJE3g4/9UjlgsGfi4grLnzIpuL7gX9RjGrhEqaDsAq+ip7pAkWXLNIoTdwzZ0RYGHThLEL8n6Pp3W/6swt83hv2lvsXLYRxdwlHiyOPATWHSE0SLtmQxpAIXpR/+DK5+Cvb+6npbJlGuB505ArlmlSvedFCSEHepEWgabnTohI5ab6Qr4/YxXhBQ=

再通过私钥在线解密也没问题。

这种的无法直接使用dongle解密。 我用dart的 crypton 可以直接解密。dongle 还有什么好的方式吗?

@Issues-translate-bot Issues-translate-bot changed the title 请问长的加密内容,因为长度问题无法解密,目前有比较好的解决方式吗? Excuse me, the long encrypted content cannot be decrypted because of the length problem. Is there a better solution at present? Dec 27, 2022
@gouguoyin
Copy link
Collaborator

Can decryption after encryption using dongle?

@kxy000
Copy link
Author

kxy000 commented Dec 27, 2022

Can decryption after encryption using dongle?

不可以的,加密失败,提示加密的内容超长了。

同样,加密后超长的内容也无法解密

message too long for RSA public key size

@kxy000
Copy link
Author

kxy000 commented Dec 27, 2022

要解密的内容是第三方的,无法改成分段或改变长度。 万分感谢。

@Issues-translate-bot
Copy link
Collaborator

The issue body's language is not English, it has been automatically translated, please use English next time. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The content to be decrypted is third-party and cannot be segmented or changed in length. Many thanks.

@gouguoyin
Copy link
Collaborator

This problem does exist,it will fix in next version

@gouguoyin gouguoyin added the bug Something isn't working label Dec 27, 2022
@gouguoyin
Copy link
Collaborator

gouguoyin commented Dec 30, 2022

v0.2.4 released and added rsa support for long plaintext public key encryption and private key decryption

https://github.com/golang-module/dongle#1rsa-encrypt-by-public-key-and-decrypt-by-private-key

@kxy000
Copy link
Author

kxy000 commented Dec 30, 2022

已经使用了,完美,感谢感谢。

@kxy000 kxy000 closed this as completed Dec 30, 2022
@Issues-translate-bot
Copy link
Collaborator

The issue body's language is not English, it has been automatically translated, please use English next time. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Already used, perfect, thank you very much.

@gouguoyin
Copy link
Collaborator

v0.2.5 released and added rsa support for long plaintext private key encryption and public key decryption

https://github.com/golang-module/dongle#2rsa-encrypt-by-private-key-and-decrypt-by-public-key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants