private void LoadPackageFromApplication(string absolutePackagePath, string packagePassword) { try { if (!string.IsNullOrEmpty(packagePassword)) { ssisApplication.PackagePassword = packagePassword; ssisPackage = ssisApplication.LoadPackage(absolutePackagePath, null); } else { ssisPackage = ssisApplication.LoadPackage(absolutePackagePath, null); } } catch (DtsRuntimeException dtxREx) { if (dtxREx.ErrorCode == -1073659849 & dtxREx.Message == "Failed to remove package protection with error 0xC0014037 \"The package is encrypted with a password. The password was not specified, or is not correct.\". This occurs in the CPackage::LoadFromXML method.\r\n") { throw new SSISCipherUtil.PasswordNotProvidedException(); } } catch (DtsComException) { } catch (Exception) { } //if package loaded succesfully, check for protection level DTSProtectionLevel protectionLevel = ssisPackage.ProtectionLevel; if (protectionLevel == DTSProtectionLevel.EncryptSensitiveWithPassword) { if (!string.IsNullOrEmpty(packagePassword)) { ssisPackage.PackagePassword = packagePassword; } else { throw new SSISCipherUtil.PasswordNotProvidedException(); } } }
private bool PasswordNeeded(DTSProtectionLevel level) { return(level == DTSProtectionLevel.EncryptAllWithPassword || level == DTSProtectionLevel.EncryptSensitiveWithPassword); }
private bool PasswordNeeded(DTSProtectionLevel level) { return (level == DTSProtectionLevel.EncryptAllWithPassword || level == DTSProtectionLevel.EncryptSensitiveWithPassword); }
public void SetProtectionLevel(Package package, DTSProtectionLevel protectionLevel) { package.ProtectionLevel = protectionLevel; }