     }
     
     class open func unlock(data: Data, password: String? = nil) -> CGPDFDocument? {
-        let dataProvider = CGDataProvider(data: data as CFData)
-        let pdf = CGPDFDocument(dataProvider!)
+        let pdf = CGPDFDocument(CGDataProvider(data: data as CFData)!)
         
         guard password != nil else { return pdf }
         

        guard scaleFactor > 0.0 else {
            return nil
        }
        
        return autoreleasepool { () -> Data in
            let data = NSMutableData()
            let pageCount = images.count - 1
            
            autoreleasepool {
                let options = (password != nil) ? self.toDocumentInfo(password: password!) : nil
                UIGraphicsBeginPDFContextToData(data, .zero, options)
                
                for index in 0...pageCount {
                    let bounds = CGRect(
                        origin: .zero,
                        size: CGSize(
                            width: images[index].size.width * scaleFactor,
                            height: images[index].size.height * scaleFactor
                        )
                    )
                    UIGraphicsBeginPDFPageWithInfo(bounds, nil)
                    images[index].draw(in: bounds)
                }
                UIGraphicsEndPDFContext()
            }
            
            return data as Data
        }
    }
    
}

    
    class open func canUnlock(fileURL: URL, password: String) -> Bool {
        do {
            return canUnlock(data: try Data(contentsOf: fileURL), password: password)
        } catch {
            return false
        }
