|
@@ -207,11 +207,14 @@ let input: [UInt8] = [0,1,2,3,4,5,6,7,8,9]
|
|
input.encrypt(AES(key: "secret0key000000", iv:"0123456789012345", blockMode: .CBC))
|
|
input.encrypt(AES(key: "secret0key000000", iv:"0123456789012345", blockMode: .CBC))
|
|
```
|
|
```
|
|
|
|
|
|
-Encrypt String to Base64 string result:
|
|
|
|
|
|
+Encrypt/Decrypt String to Base64 encoded string:
|
|
|
|
|
|
```swift
|
|
```swift
|
|
// Encrypt string and get Base64 representation of result
|
|
// Encrypt string and get Base64 representation of result
|
|
-let base64: String = try! "my secret string".encrypt(AES(key: "secret0key000000", iv: "0123456789012345"))
|
|
|
|
|
|
+let base64String = try! "my secret string".encrypt(AES(key: "secret0key000000", iv: "0123456789012345")).toBase64()
|
|
|
|
+
|
|
|
|
+// Decrypt Base64 encrypted message with helper function:
|
|
|
|
+let decrypted = try! encryptedBase64.decryptBase64ToString(AES(key: "secret0key000000", iv: "0123456789012345"))
|
|
```
|
|
```
|
|
|
|
|
|
...under the hood, this is [UInt8] converted to NSData converted to Base64 string representation:
|
|
...under the hood, this is [UInt8] converted to NSData converted to Base64 string representation:
|