TakeScoop / SwiftyRSA

RSA public/private key encryption in Swift
MIT License
1.28k stars 346 forks source link

Signed with privateKey in SHA256 #181

Open kyounghak opened 4 years ago

kyounghak commented 4 years ago

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
EvgeniyPiskunov commented 4 years ago

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

kyounghak commented 4 years ago

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

EvgeniyPiskunov commented 4 years ago

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

kyounghak commented 4 years ago

@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.

marain87 commented 4 years ago

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

kyounghak commented 4 years ago

@marain87 good to hear that you solved problem anyway.