Last active
December 16, 2015 02:50
-
-
Save telliott99/2861121072721372dae4 to your computer and use it in GitHub Desktop.
attempt at using SSL (failed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func encrypt() { | |
let msg = "My messageXXXXXX" | |
let key = "my secret pwXXXX" | |
var keyBuffer = [UInt8]( | |
count: 16, | |
repeatedValue: 0) | |
var cipherBuffer = [UInt8]( | |
count: 16, | |
repeatedValue: 0) | |
AES_set_encrypt_key( | |
key, | |
128, // bits, see aes.h | |
UnsafeMutablePointer<AES_KEY>(keyBuffer)) | |
Swift.print("\(keyBuffer)") | |
AES_encrypt( | |
msg, | |
UnsafeMutablePointer<UInt8>(cipherBuffer), | |
UnsafePointer<AES_KEY>(keyBuffer) ) | |
Swift.print("\(cipherBuffer)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment