You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class func decrypt(encodedData: String, secret: String, algorithm: String) -> String {
do {
let key = Array(secret.utf8)
let bytes = encodedData.hexaBytes
let cryptor = try Cryptor(operation:.decrypt, algorithm:.aes256, options:[.ecbMode, .pkcs7Padding], key:key, iv:[UInt8]())
if let decrypted = cryptor.update(byteArray: bytes)?.final() {
return String(bytes: decrypted, encoding: .utf8) ?? ""
}
} catch {
print(error)
}
return ""
}
i am using above function to decrypt data. it will returning blank "" string.
i am using .ecbMode and .pkcs7Padding pattern
also i am getting key and bytes data successfully. issue in cryptor.update function.
The text was updated successfully, but these errors were encountered:
i am using above function to decrypt data. it will returning blank "" string.
i am using .ecbMode and .pkcs7Padding pattern
also i am getting key and bytes data successfully. issue in cryptor.update function.
The text was updated successfully, but these errors were encountered: