     /// :returns: true if the signature is valid (and can be validated)
     ///
     public func verify(message: String, var signatureBase64: String, urlEncoded: Bool = true) -> Bool {
-        if let key = obtainKey(.Public) {
-            if urlEncoded {
-                signatureBase64 = signatureBase64.stringByReplacingOccurrencesOfString("_", withString: "/")
-                signatureBase64 = signatureBase64.stringByReplacingOccurrencesOfString("-", withString: "+")
-            }
-            
-            if let signature = NSData(base64EncodedString: signatureBase64, options: .allZeros),
-                messageData = message.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false),
-                hashData = NSMutableData(length: Int(CC_SHA256_DIGEST_LENGTH)) {
-                    
-                CC_SHA256(messageData.bytes, CC_LONG(messageData.length), UnsafeMutablePointer(hashData.mutableBytes))
-                
-                let signedData = UnsafePointer<UInt8>(hashData.bytes)
-                let signatureLength = Int(signature.length)
-                let signatureData = UnsafePointer<UInt8>(signature.bytes)
-                
-                let result = SecKeyRawVerify(key, SecPadding(kSecPaddingPKCS1SHA256), signedData, Int(CC_SHA256_DIGEST_LENGTH), signatureData, signatureLength)
-                
-                switch result {
-                case noErr:
-                    return true
-                default:
-                    return false
-                }
+        if urlEncoded {
+            signatureBase64 = signatureBase64.stringByReplacingOccurrencesOfString("_", withString: "/")
+            signatureBase64 = signatureBase64.stringByReplacingOccurrencesOfString("-", withString: "+")
+        }
+
+        if let data = message.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false), signature = NSData(base64EncodedString: signatureBase64, options: .allZeros) {
+            return self.verify(data, signatureData: signature)
+        }
+        
+        return false
+    }
+    
+    ///
+    /// Verify a data payload with the given signature
+    ///
+    /// :param: data            Data the signature should be verified against
+    /// :param: signatureData   Data of the signature
+    ///
+    /// :returns: True if the signature is valid
+    ///
+    public func verify(data: NSData, signatureData: NSData) -> Bool {
+        if let key = obtainKey(.Public), hashData = NSMutableData(length: Int(CC_SHA256_DIGEST_LENGTH)) {
+            CC_SHA256(data.bytes, CC_LONG(data.length), UnsafeMutablePointer(hashData.mutableBytes))
+            
+            let signedData = UnsafePointer<UInt8>(hashData.bytes)
+            let signatureLength = Int(signatureData.length)
+            let signatureData = UnsafePointer<UInt8>(signatureData.bytes)
+            
+            let result = SecKeyRawVerify(key, SecPadding(kSecPaddingPKCS1SHA256), signedData, Int(CC_SHA256_DIGEST_LENGTH), signatureData, signatureLength)
+            
+            switch result {
+            case noErr:
+                return true
+            default:
+                return false
             }
         }
         

    ///
    /// Generate a signature for an arbitrary message
    ///
    /// :param: message     Message to generate the signature for
    /// :param: urlEncode   True if the resulting Base64 data should be URL encoded
    ///
    /// :returns: Signature as a Base64 string
    ///
    public func sign(message: String, urlEncode: Bool = false) -> String? {
        if let key = obtainKey(.Private), messageData = message.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false), hash = NSMutableData(length: Int(CC_SHA256_DIGEST_LENGTH)) {
            
            // Create SHA256 hash of the message
            CC_SHA256(messageData.bytes, CC_LONG(messageData.length), UnsafeMutablePointer(hash.mutableBytes))
            
            // Sign the hash with the private key
            let blockSize = SecKeyGetBlockSize(key)

    }
    
    
    private class func encrypt(data: NSData, key: NSData) -> NSData? {
        let dataBytes = UnsafePointer<UInt8>(data.bytes)
        let dataLength = data.length
        
        if let result = NSMutableData(length: dataLength + kCCBlockSizeAES128) {
            let keyData = UnsafePointer<UInt8>(key.bytes)
            let keyLength = size_t(key.length)
            
            var encryptedData = UnsafeMutablePointer<UInt8>(result.mutableBytes)
            let encryptedDataLength = size_t(result.length)
            
            var encryptedLength: size_t = 0
            
            let status = CCCrypt(CCOperation(kCCEncrypt), CCAlgorithm(kCCAlgorithmAES128), CCOptions(kCCOptionECBMode + kCCOptionPKCS7Padding), keyData, keyLength, nil, dataBytes, dataLength, encryptedData, encryptedDataLength, &encryptedLength)
            
            if UInt32(status) == UInt32(kCCSuccess) {
                result.length = Int(encryptedLength)
                return result
            }
        }
        
