I am trying to learn to use RNCryptor. Here is what I am using:
let key = "1234"
let original_text = "hello"
let data = original_text.data(using: .utf8)!
let encrypted_data = RNCryptor.encrypt(data: data, withPassword: key)
print(String(data: encrypted_data, encoding: .utf8))
This prints 'nil'. How can I convert encrypted_data
to a String?
Also, this does work:
try! print(String(data: RNCryptor.decrypt(data: encrypted_data, withPassword: key), encoding: .utf8))
but this is the original text and not the cipher text.