                 if status == noErr {
                     // Create Base64 string of the result
                     result.length = encryptedDataLength
-                    var signature = result.base64EncodedStringWithOptions(.allZeros)
-                    
-                    if urlEncode {
-                        signature = signature.stringByReplacingOccurrencesOfString("/", withString: "_")
-                        signature = signature.stringByReplacingOccurrencesOfString("+", withString: "-")
-                    }
-                    
-                    return signature
+                    return result
                 }
             }
         }
         
         return nil
     }
+    
     
     ///
     /// Verify the message with the given signature

    /// Decrypt a Base64 string representation of encrypted data
    ///
    /// :param: base64String    string containing Base64 data to decrypt
    /// :param: urlEncoded      whether the input Base64 data is URL encoded (if true, some additional changes need to be made first)
    ///
    /// :returns: Decrypted string as plain text
    ///
    public func decrypt(var base64String: String, urlEncoded: Bool = true) -> String? {
        if let key = obtainKey(.Private) {
            if urlEncoded {
                base64String = base64String.stringByReplacingOccurrencesOfString("_", withString: "/")
                base64String = base64String.stringByReplacingOccurrencesOfString("-", withString: "+")
            }
            
            // Convert to data and grab our private key
            if let data = NSData(base64EncodedString: base64String, options: .allZeros) {
                // First block size should be the encrypted AES key
                let blockSize = SecKeyGetBlockSize(key)
                let keyData = data.subdataWithRange(NSRange(location: 0, length: blockSize))
                let messageData = data.subdataWithRange(NSRange(location: blockSize, length: data.length - blockSize))
                
                // Decrypt the key
                if let decryptedKeyData = NSMutableData(length: blockSize) {
                    let encryptedData = UnsafePointer<UInt8>(keyData.bytes)
                    var decryptedData = UnsafeMutablePointer<UInt8>(decryptedKeyData.mutableBytes)
                    var decryptedLength = blockSize
                    
                    let keyStatus = SecKeyDecrypt(key, SecPadding(kSecPaddingPKCS1), encryptedData, keyData.length, decryptedData, &decryptedLength)
                    
                    if keyStatus == noErr {
                        decryptedKeyData.length = Int(decryptedLength)
                        
                        // Decrypt the message
                        if let message = Heimdall.decrypt(messageData, key: decryptedKeyData) {
                            return NSString(data: message, encoding: NSUTF8StringEncoding) as? String
                        }
                    }
                }
            }

    /// :returns: true if the signature is valid (and can be validated)
    ///
    public func verify(message: String, var signatureBase64: String, urlEncoded: Bool = true) -> Bool {
        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
            }
        }
        
