RNCryptorType
public protocol RNCryptorType
The RNCryptorType
protocol defines generic API to a mutable,
incremental, password-based encryptor or decryptor. Its generic
usage is as follows:
let cryptor = Encryptor(password: "mypassword")
// or Decryptor()
var result NSMutableData
for data in datas {
result.appendData(try cryptor.update(data))
}
result.appendData(try cryptor.final())
After calling finalData()
, the cryptor is no longer valid.
-
Creates and returns a cryptor.
Declaration
Swift
init(password: String)
Parameters
password
Non-empty password string. This will be interpretted as UTF-8.
-
Updates cryptor with data and returns processed data.
Throws
Error
Declaration
Swift
func updateWithData(data: NSData) throws -> NSData
Parameters
data
Data to process. May be empty.
Return Value
Processed data. May be empty.
-
Returns trailing data and invalidates the cryptor.
Throws
Error
Declaration
Swift
func finalData() throws -> NSData
Return Value
Trailing data