SwiftyRSA icon indicating copy to clipboard operation
SwiftyRSA copied to clipboard

Random Encription Padding problems when send info to JAVA API

Open mnel75 opened this issue 4 years ago • 7 comments

When send encrypted string using Public Key to JAVA server , the server when try to decrypt have padding errors.

We detect all the encripted string with the end "SAA==" fails , the other encripted string works perfetly.

SwiftyRSA pod version 1.6.0 Using XCode 11.4.1

Samples with Padding Errors:

mVv/nkjn0FPks1MBmmtsw4cQXT/aIH1Z1ftDn1tlBrCNo9RGMmyZ6pRH7mCxmZqrT0sNgYxGgJgflqFFGHd/Bf/IfTzgwrx4u5LhtdpNFJiNw5CfLq9HNbcv1OsarDJsJEAuMtQGpVLVCzY00JMPbhuPGq2toII93aW36iAQbvfSUDJOVGQtx4LJ9SKyawYC9c2U/2EdtdK+Q6rfBAURBHma+zlA7l5dxMEWp1iXJ6nS48vmpXiHBiQ3RfGmdz/CdV5KIIsRGO9DxzNQKsMFRai9HUPVAntE+yv/k7Iez7UFaB3sJjgIkTfsysNlSMiY0OuGbW1WBXK5BNKBwmwSAA==

v12tiH/QmN6V1EUStJAjP9fXk+1AR9psrz3/OO6sOo4UYx1JI5uOwUagZ/+F/WcLVIvfkDl95RBn3PkLR4Ld+1pL7vCDaX32dv7T6kgTcX4gm1+OkhhC7K7ybMfXo9JAHWSkyTaTNs90G8fkrBBoVMOqyOqI4e5SL1+iFYBzpVlGGEPYt3EDTA5gNEvNdm6Xzjn4imeeeapB3ItBmWzl627+NQceLHEgTVmm6XGMejEvbnl8EaF25zRYFxQU7o4YpaF1EWMantVksU+aPfkQVm07X+fC4rZ/7iacbSqi/Lz9/UhGL7UOylbSA/mwcl0sLmF4qLzpKsJiYC+BxVQSAA==

Other String without error

N1gGxBgvhHFhZK1/wwmrUAjDtMmWW8Ez3FrLb9I4KZDG+V9/pHni/OZboJ1OgucfThLh4QSRP1dBec4mkZmj7FMi8MULYzmMHw+W6eap0le+EtxPc2SJlwmgimJJGM2WjS0qhpCjopEO7DDegMBGL0UijK2DRZaer+/WMDAid7HLeFQN4Zm6Sg7I0AZV9RAqBnZ7haYbqXj2XeaGjIAcB9+UAdrvHOcTanufGjTyrCpUlpSZKvrxRxFTR7a7o2+ihqC5FuDvsuFo2y4TvTAraXKib+FmleTZhzaxLrcVTal/jyA6T2XLhJsa5j0p2hgl5hKOGaObORSouEJF4I/axw==

mnel75 avatar Feb 09 '21 19:02 mnel75

I have the same problem using XCode 12.4

Issa-Abdulhadi avatar Feb 21 '21 10:02 Issa-Abdulhadi

1.6.0 fixed this

cloudfox2 avatar May 17 '21 06:05 cloudfox2

I have the same problem, I use the 1.5.0. Could you confirm the next version 1.6.0 fixes the bug? @cloudfox2

asam139 avatar Sep 03 '21 17:09 asam139

I checked that the problem is the version of Swift. With version 4 fails, instead, version 5 works in any situation.

asam139 avatar Sep 06 '21 08:09 asam139

I noticed that after version 1.6.0, the minimum dependent version of iOS has been changed to IOS 11.0. Is this change related to fixing this problem?

At present, the situation here is that I clone the 1.7.0 code and add it to my project. The minimum iOS dependent version of my project is iOS 9.0. It is found that this problem will still occur, and the error rate is less than one in 50 000. @cloudfox2

yanxiaobing avatar Feb 18 '22 03:02 yanxiaobing

My situation was, I was using version 1.5.0, and after I updated XCode, the problem appeared, then I update SwiftyRSA to 1.6.0 and Swift version from 4.1 to 5.0, and the problem never occurs. I think the problem is mainly related to Swift version. @yanxiaobing

cloudfox2 avatar Feb 21 '22 01:02 cloudfox2

My situation was, I was using version 1.5.0, and after I updated XCode, the problem appeared, then I update SwiftyRSA to 1.6.0 and Swift version from 4.1 to 5.0, and the problem never occurs. I think the problem is mainly related to Swift version. @yanxiaobing

Thanks for sharing.

yanxiaobing avatar Feb 22 '22 10:02 yanxiaobing