Closed dearwayne closed 6 years ago
Please send me what was the error.
Please send me what was the error.
The error: SwCrypt.swift:1139: [decrypt(_:derKey:tag:padding:digest:)] SwCryptTest.CC.CCError: decodeError (-4304)
Thanks! It looks like it's a bug in the Apple's CommonCrypto or CoreCrypto components. The good news it disappeared in the iOS 8.3.
i got same problem when decode base64 string like this:
jH1pRwsdUmuqFZIfUIFux25Dbk8LY7gyteiAlQXeW8nOirUIHzzYvadBkmMQNhGqB19bd74tnCbyv8iQwovUpZmxleCsYWFCgzqkx+jQ9TGE4AavwUxJcrdjkXc7AOfQtJHfcgHMVziKrKiZNXi3j3tPIAhA+xFxjZTcSdssIUhcWv9nuPJcjgj18++qd6nL07LVEkqyHqENhX8HnwbWJ8jjeavoO6MV03nCTG2zqOnLThreoTSXl0HX8nhKRim/sklYslYFTXtiMwSY/VtGE5nq7qHgndRDOdJk15w8pS36uuuYbBbhNah9dNT38aHUt0cpZKISMZSghcC6+K1RMg==
using RSA256 like server, i got data but can not convert to string
guard let data = Data(base64Encoded: dataStr) else { return }
let d = try? CC.RSA.decrypt(data, derKey: priv, tag: Data(), padding: .oaep, digest: .sha256)
guard let decryptData = d else { return }
print("data: \(String(data: decryptData.0, encoding: .utf8))")
always print nil
Xcode: 9.3.1 Code:
decypt failure on Simulator:iPhone 5s 8.1,but success on Simulator: iPhone SE 11.3.
It should be support iOS 5.0 and upper,But why decrypt failure on iOS 8.1?