Skip to content

Instantly share code, notes, and snippets.

@telliott99
Last active December 16, 2015 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save telliott99/2861121072721372dae4 to your computer and use it in GitHub Desktop.
Save telliott99/2861121072721372dae4 to your computer and use it in GitHub Desktop.
attempt at using SSL (failed)
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