         return autoreleasepool { () -> Bool in
             do {
                 let data = try Data(contentsOf: fileURL)
-                return canUnlock(input: data, password: password)
+                return canUnlock(data: data, password: password)
             } catch {
                 return false
             }
         }
     }
     
-    class open func canUnlock(input: Data, password: String) -> Bool {
-        return autoreleasepool { () -> Bool in
-            let dataProvider = CGDataProvider(data: input as CFData)
+    class open func canUnlock(data: Data, password: String) -> Bool {
+        return autoreleasepool { () -> Bool in
+            let dataProvider = CGDataProvider(data: data as CFData)
             let pdf = CGPDFDocument(dataProvider!)
             
             // Try a blank password first, per Apple's Quartz PDF example

        
        return autoreleasepool { () -> Data in
            let data = NSMutableData()
            
            autoreleasepool {
                let options = (password != nil) ? self.toDocumentInfo(password: password!) : nil
                UIGraphicsBeginPDFContextToData(data, .zero, options)
                
                let bounds = CGRect(
                    origin: .zero,
                    size: CGSize(
                        width: image.size.width * scaleFactor,
                        height: image.size.height * scaleFactor
                    )
                )
                UIGraphicsBeginPDFPageWithInfo(bounds, nil)
                image.draw(in: bounds)
                
                UIGraphicsEndPDFContext()
            }
            

                }
            }
            return true
        }
    }
    
    class open func unlock(data: Data, password: String? = nil) -> CGPDFDocument? {
        return autoreleasepool { () -> CGPDFDocument? in
            let dataProvider = CGDataProvider(data: data as CFData)
            let pdf = CGPDFDocument(dataProvider!)
            
            guard password != nil else { return pdf }
            
            return unlock(pdf: pdf!, password: password)
        }
    }
    
    class open func unlock(pdf: CGPDFDocument, password: String? = nil) -> CGPDFDocument? {
        
        guard password != nil else { return pdf }
        
        return autoreleasepool { () -> CGPDFDocument? in
            // Try a blank password first, per Apple's Quartz PDF example
            if pdf.isEncrypted == true &&
                pdf.unlockWithPassword("") == false {
                if let pwd = password {
                    // Nope, now let's try the provided password to unlock the PDF
                    if let cPasswordString = pwd.cString(using: String.Encoding.utf8) {
                        if pdf.unlockWithPassword(cPasswordString) == true {
                            return pdf
                        }
                    }
                }
            }
            return nil
        }
    }
    
