SwiftyRSA icon indicating copy to clipboard operation
SwiftyRSA copied to clipboard

Signed with privateKey in SHA256

Open kyounghak opened this issue 6 years ago • 6 comments

Im using version 1.5.0 with carthage. sometime signed with sha 256 makes different result with same value

let privateKeyRSA = try PrivateKey(base64Encoded: privateKey) let hmacData = "test".hmac(key: masterKey) let clear = try ClearMessage(string: hmacData, using: .utf8) let signature = try clear.signed(with: privateKeyRSA, digestType: .sha256)

this is my code using make hmac string with "test" string and masterKey. and with that hmac string make clear message then signed with private key

however sometimes if i call that function right away when view is loaded got different result compare with result calling function after few second.

this is failed result one 스크린샷 2020-04-03 오전 10 33 58

this is succes result one 스크린샷 2020-04-03 오전 10 34 06

kyounghak avatar Apr 03 '20 01:04 kyounghak

I have the same problem, please pay attention to this.

EvgeniyPiskunov avatar Jul 27 '20 11:07 EvgeniyPiskunov

@EvgeniyPiskunov what i did to handle this problem. I used blueRSA for making signing value.

kyounghak avatar Jul 27 '20 13:07 kyounghak

blueRSA with 10.3 ios I have an application with 9.0 =(

EvgeniyPiskunov avatar Jul 27 '20 14:07 EvgeniyPiskunov

@EvgeniyPiskunov oh..... there are some other libraries like SwCrypt, SwiftRSA... try to use that one just for signing value.... :( if i found other good source or handle that problem i will leave comment here.

kyounghak avatar Jul 28 '20 01:07 kyounghak

I got the same problem. Finally, I changed to use SwCrypt for sign and verify the signature.

marain87 avatar Sep 15 '20 01:09 marain87

@marain87 good to hear that you solved problem anyway.

kyounghak avatar Sep 15 '20 02:09 kyounghak