| | |
| | | // output stream. |
| | | if (encrypt) |
| | | { |
| | | String cipherAlgorithm = cryptoManager.getPreferredCipherTransformation(); |
| | | backupProperties.put(BACKUP_PROPERTY_CIPHER_ALGORITHM, cipherAlgorithm); |
| | | try |
| | | { |
| | | outputStream |
| | | = cryptoManager.getCipherOutputStream(outputStream); |
| | | } |
| | | catch (Exception e) |
| | | catch (CryptoManager.CryptoManagerException e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | |
| | | } |
| | | |
| | | Message message = ERR_SCHEMA_BACKUP_CANNOT_GET_CIPHER.get( |
| | | cipherAlgorithm, stackTraceToSingleLineString(e)); |
| | | e.getMessage()); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message, e); |
| | | } |
| | |
| | | // in a cipher input stream. |
| | | if (backupInfo.isEncrypted()) |
| | | { |
| | | String cipherAlgorithm = |
| | | backupInfo.getBackupProperty(BACKUP_PROPERTY_CIPHER_ALGORITHM); |
| | | if (cipherAlgorithm == null) |
| | | { |
| | | Message message = ERR_SCHEMA_RESTORE_UNKNOWN_CIPHER.get(backupID); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message); |
| | | } |
| | | |
| | | try |
| | | { |
| | | inputStream = DirectoryServer.getCryptoManager() |
| | | .getCipherInputStream(inputStream); |
| | | } |
| | | catch (Exception e) |
| | | catch (CryptoManager.CryptoManagerException e) |
| | | { |
| | | Message message = ERR_SCHEMA_RESTORE_CANNOT_GET_CIPHER. |
| | | get(cipherAlgorithm, backupFile.getPath()); |
| | | get(backupFile.getPath(), e.getMessage()); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message, e); |
| | | } |