From e6a7ecfc71d6b0144a6366cd2520e2f03846b033 Mon Sep 17 00:00:00 2001
From: david_page <david_page@localhost>
Date: Wed, 05 Sep 2007 17:58:40 +0000
Subject: [PATCH] Update CryptoManager secret key encryption public API:
---
opends/src/server/org/opends/server/backends/jeb/BackupManager.java | 21 +++++----------------
1 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/BackupManager.java b/opends/src/server/org/opends/server/backends/jeb/BackupManager.java
index 6456125..c2eca97 100644
--- a/opends/src/server/org/opends/server/backends/jeb/BackupManager.java
+++ b/opends/src/server/org/opends/server/backends/jeb/BackupManager.java
@@ -37,9 +37,6 @@
import org.opends.server.types.DirectoryException;
import org.opends.server.types.RestoreConfig;
-import javax.crypto.Cipher;
-import javax.crypto.CipherInputStream;
-import javax.crypto.CipherOutputStream;
import javax.crypto.Mac;
import java.io.BufferedReader;
import java.io.File;
@@ -345,13 +342,13 @@
// output stream.
if (encrypt)
{
- String cipherAlgorithm = cryptoManager.getPreferredCipherAlgorithm();
+ String cipherAlgorithm = cryptoManager.getPreferredCipherTransformation();
backupProperties.put(BACKUP_PROPERTY_CIPHER_ALGORITHM, cipherAlgorithm);
- Cipher cipher;
try
{
- cipher = cryptoManager.getPreferredCipher(Cipher.ENCRYPT_MODE);
+ outputStream
+ = cryptoManager.getCipherOutputStream(outputStream);
}
catch (Exception e)
{
@@ -365,8 +362,6 @@
throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
message, e);
}
-
- outputStream = new CipherOutputStream(outputStream, cipher);
}
@@ -983,10 +978,9 @@
String cipherAlgorithm =
backupProperties.get(BACKUP_PROPERTY_CIPHER_ALGORITHM);
- Cipher cipher;
try
{
- cipher = cryptoManager.getCipher(cipherAlgorithm, Cipher.DECRYPT_MODE);
+ inputStream = cryptoManager.getCipherInputStream(inputStream);
}
catch (Exception e)
{
@@ -1000,8 +994,6 @@
throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
message, e);
}
-
- inputStream = new CipherInputStream(inputStream, cipher);
}
@@ -1318,10 +1310,9 @@
String cipherAlgorithm =
backupProperties.get(BACKUP_PROPERTY_CIPHER_ALGORITHM);
- Cipher cipher;
try
{
- cipher = cryptoManager.getCipher(cipherAlgorithm, Cipher.DECRYPT_MODE);
+ inputStream = cryptoManager.getCipherInputStream(inputStream);
}
catch (Exception e)
{
@@ -1335,8 +1326,6 @@
throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
message, e);
}
-
- inputStream = new CipherInputStream(inputStream, cipher);
}
--
Gitblit v1.10.0