{
"order_id": 5,
"no": "19000038",
"id": 10,
"name": "John Doe"
}
I encrypt above data using online AES encryption website which is: https://www.devglan.com/online-tools/aes-encryption-decryption
using CBC mode, 256 Key size and Base64 output text format. I copied playground by @/backslash-f on this link: AES encryption in swift
and below is how I write to decrypt the encrypted data:
let stringData = Data(base64Encoded: stringValue, options: .ignoreUnknownCharacters)
do {
let aes = try AES(keyString: key)
let decryptedData: String = try aes.decrypt(stringData!)
print("String decrypted:\t\t\t\(decryptedData)")
}
catch {
print("Something went wrong: \(error)")
}
the data successfully decrypted but there are missing characters. Below is the decrypted data (as printed in the code):
String decrypted: ,
"order_no": "19000038",
"id": 10,
"name": "John Doe"
}
as you can see, the first curly bracket until the "order_id": 5 is missing. Do anyone knows why this happens and how to fix this?