ava
ava

Reputation: 1176

Encrypt and Decrypt video file after downloading

I have a table view that contain video files, I want to download this video file from url and show download progress for every cell , and after finishing downloading, I want to encrypt downloaded video file and when user want to open video I have to decrypt this and show to user. but I did not find a solution for encrypt and decrypt the video file. someone have any solution for encrypt and decryption for video file.

Upvotes: 0

Views: 1685

Answers (1)

zaph
zaph

Reputation: 112857

Just use iOS build-in Data Protection and the encryption and decryption will be done by iOS automatically on writing the file and reading the file.

Set completeFileProtection when writing the data:

static var completeFileProtection: NSData.WritingOptions { get }

The file is stored in an encrypted format and may be read from or written to only while the device is unlocked. At all other times, attempts to read and write the file result in failure.

See iOS Security Page 11: Encryption and Data Protection, File Data Protection.

Upvotes: 2

Related Questions