mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

david_page
14.45.2007 4848fb2b93e6c3e2aa0d01703ce3becc895d89ca
No issue.
CryptoManager
Step 1 to factor a CryptoManager interface from the implementation.
2 files added
5 files renamed
15 files modified
169 ■■■■ changed files
opends/resource/config/config.ldif 2 ●●● patch | view | raw | blame | history
opends/src/admin/defn/org/opends/server/admin/std/GetSymmetricKeyExtendedOperationHandlerConfiguration.xml 2 ●●● patch | view | raw | blame | history
opends/src/ads/org/opends/admin/ads/ADSContext.java 2 ●●● patch | view | raw | blame | history
opends/src/ads/org/opends/admin/ads/ADSContextHelper.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/SchemaBackend.java 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/BackupManager.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/JebFormat.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/DirectoryServer.java 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/crypto/CryptoManager.java 39 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/crypto/CryptoManagerSync.java 5 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/crypto/GetSymmetricKeyExtendedOperation.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/crypto/package-info.java 39 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/AESPasswordStorageScheme.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/BlowfishPasswordStorageScheme.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/ConfigFileHandler.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/RC4PasswordStorageScheme.java 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/TripleDESPasswordStorageScheme.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/ReplSessionSecurity.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/DirectoryConfig.java 2 ●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/crypto/CryptoManagerTestCase.java 6 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/crypto/CryptoTestCase.java 37 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/crypto/GetSymmetricKeyExtendedOperationTestCase.java 8 ●●●● patch | view | raw | blame | history
opends/resource/config/config.ldif
@@ -545,7 +545,7 @@
objectClass: ds-cfg-extended-operation-handler
objectClass: ds-cfg-get-symmetric-key-extended-operation-handler
cn: Get Symmetric Key
ds-cfg-java-class: org.opends.server.extensions.GetSymmetricKeyExtendedOperation
ds-cfg-java-class: org.opends.server.crypto.GetSymmetricKeyExtendedOperation
ds-cfg-enabled: true
dn: cn=Who Am I,cn=Extended Operations,cn=config
opends/src/admin/defn/org/opends/server/admin/std/GetSymmetricKeyExtendedOperationHandlerConfiguration.xml
@@ -51,7 +51,7 @@
    <adm:default-behavior>
      <adm:defined>
        <adm:value>
          org.opends.server.extensions.GetSymmetricKeyExtendedOperation
          org.opends.server.crypto.GetSymmetricKeyExtendedOperation
        </adm:value>
      </adm:defined>
    </adm:default-behavior>
opends/src/ads/org/opends/admin/ads/ADSContext.java
@@ -2172,7 +2172,7 @@
   value to ds-cfg-public-key-certificate;binary value. Note that the collection
   might be empty.
   @throws ADSContextException in case of problems with the entry search.
   @see org.opends.server.types.CryptoManager#getTrustedCertificates
   @see org.opends.server.crypto.CryptoManager#getTrustedCertificates
   */
  public Map<String,byte[]> getTrustedCertificates()
          throws ADSContextException
opends/src/ads/org/opends/admin/ads/ADSContextHelper.java
@@ -50,7 +50,7 @@
import org.opends.server.admin.std.meta.BackendCfgDefn;
import org.opends.server.admin.std.meta.LDIFBackendCfgDefn;
import org.opends.server.config.ConfigConstants;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DN;
/**
opends/src/server/org/opends/server/backends/SchemaBackend.java
@@ -88,7 +88,7 @@
import org.opends.server.types.BackupInfo;
import org.opends.server.types.ConditionResult;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DITContentRule;
@@ -128,7 +128,6 @@
import static org.opends.server.util.StaticUtils.*;
/**
 * This class defines a backend to hold the Directory Server schema information.
 * It is a kind of meta-backend in that it doesn't actually hold any data but
opends/src/server/org/opends/server/backends/jeb/BackupManager.java
@@ -33,7 +33,7 @@
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.BackupInfo;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.RestoreConfig;
opends/src/server/org/opends/server/backends/jeb/JebFormat.java
@@ -34,7 +34,7 @@
import org.opends.server.protocols.asn1.ASN1Integer;
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.protocols.asn1.ASN1Sequence;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.EntryEncodeConfig;
opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -145,7 +145,7 @@
import org.opends.server.types.AttributeValue;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.Control;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DITContentRule;
import org.opends.server.types.DITStructureRule;
import org.opends.server.types.DN;
@@ -190,6 +190,7 @@
import org.opends.server.workflowelement.localbackend.*;
import org.opends.server.protocols.internal.InternalConnectionHandler;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.crypto.CryptoManagerSync;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
opends/src/server/org/opends/server/crypto/CryptoManager.java
File was renamed from opends/src/server/org/opends/server/types/CryptoManager.java
@@ -24,7 +24,7 @@
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.server.types;
package org.opends.server.crypto;
import org.opends.messages.Message;
import static org.opends.messages.CoreMessages.*;
@@ -86,7 +86,7 @@
import org.opends.server.tools.LDAPConnectionOptions;
import org.opends.server.tools.LDAPReader;
import org.opends.server.tools.LDAPWriter;
import org.opends.server.extensions.GetSymmetricKeyExtendedOperation;
import org.opends.server.types.*;
/**
 This class implements the Directory Server cryptographic framework,
@@ -106,8 +106,8 @@
 @see "src/admin/defn/org/opends/server/admin/std\
                                      /CryptoManagerConfiguration.xml"
 @see org.opends.server.core.CryptoManagerSync
 @see org.opends.server.extensions.GetSymmetricKeyExtendedOperation
 @see org.opends.server.crypto.CryptoManagerSync
 @see org.opends.server.crypto.GetSymmetricKeyExtendedOperation
 */
@org.opends.server.types.PublicAPI(
     stability=org.opends.server.types.StabilityLevel.VOLATILE,
@@ -203,23 +203,20 @@
  /**
   * Creates a new instance of this crypto manager object from a given
   * configuration, plus some static member initialization.
   *
   * @param   cfg  The configuration of this crypto manager.
   *
   * @throws  ConfigException  If a problem occurs while creating this
   *                           crypto manager that is a result of a
   *                           problem in the configuration.
   *
   * @throws  InitializationException  If a problem occurs while
   *                                   creating this crypto manager
   *                                   that is not the result of a
   *                                   problem in the configuration.
   Creates a new instance of this crypto manager object from a given
   configuration, plus some static member initialization.
   @param cfg  The configuration of this crypto manager.
   @throws ConfigException  If a problem occurs while creating this
   {@code CryptoManager} that is a result of a problem in the configuration.
   @throws org.opends.server.types.InitializationException  If a problem
   occurs while creating this {@code CryptoManager} that is not the result of a
   problem in the configuration.
   */
  public CryptoManager(CryptoManagerCfg cfg)
         throws ConfigException, InitializationException
  {
         throws ConfigException, InitializationException {
    if (!schemaInitDone) {
      // Initialize various schema references.
      attrKeyID = DirectoryServer.getAttributeType(
@@ -2838,7 +2835,7 @@
     * @return  The key entry associated with the key identifier, or
     * {@code null} if no such entry exists.
     *
     * @see org.opends.server.types.CryptoManager.MacKeyEntry
     * @see org.opends.server.crypto.CryptoManager.MacKeyEntry
     *  #getKeyEntry(org.opends.server.types.CryptoManager,
     *               java.lang.String, int)
     */
@@ -3304,7 +3301,7 @@
     * @return  The key entry associated with the key identifier, or
     * {@code null} if no such entry exists.
     *
     * @see org.opends.server.types.CryptoManager.CipherKeyEntry
     * @see org.opends.server.crypto.CryptoManager.CipherKeyEntry
     *     #getKeyEntry(org.opends.server.types.CryptoManager,
     *                  java.lang.String, int)
     */
opends/src/server/org/opends/server/crypto/CryptoManagerSync.java
File was renamed from opends/src/server/org/opends/server/core/CryptoManagerSync.java
@@ -25,7 +25,7 @@
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.core;
package org.opends.server.crypto;
import org.opends.server.api.Backend;
import org.opends.server.api.BackendInitializationListener;
@@ -51,6 +51,9 @@
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.controls.PersistentSearchChangeType;
import org.opends.server.controls.EntryChangeNotificationControl;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.AddOperation;
import static org.opends.messages.CoreMessages.*;
import org.opends.messages.Message;
import org.opends.admin.ads.ADSContext;
opends/src/server/org/opends/server/crypto/GetSymmetricKeyExtendedOperation.java
File was renamed from opends/src/server/org/opends/server/extensions/GetSymmetricKeyExtendedOperation.java
@@ -25,7 +25,7 @@
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.extensions;
package org.opends.server.crypto;
import org.opends.server.admin.std.server.
            GetSymmetricKeyExtendedOperationHandlerCfg;
opends/src/server/org/opends/server/crypto/package-info.java
New file
@@ -0,0 +1,39 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
/**
 This package implements the Directory Server cryptographic framework,
 which is described in the
 <a href="https://www.opends.org/wiki//page/TheCryptoManager">
 CrytpoManager design document</a>.
 */
@org.opends.server.types.PublicAPI(
     stability=org.opends.server.types.StabilityLevel.PRIVATE)
package org.opends.server.crypto;
opends/src/server/org/opends/server/extensions/AESPasswordStorageScheme.java
@@ -38,7 +38,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.ByteString;
import org.opends.server.types.ByteStringFactory;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
opends/src/server/org/opends/server/extensions/BlowfishPasswordStorageScheme.java
@@ -38,7 +38,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.ByteString;
import org.opends.server.types.ByteStringFactory;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -82,7 +82,7 @@
import org.opends.server.types.BackupInfo;
import org.opends.server.types.ConditionResult;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DirectoryEnvironmentConfig;
import org.opends.server.types.DirectoryException;
opends/src/server/org/opends/server/extensions/RC4PasswordStorageScheme.java
@@ -38,7 +38,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.ByteString;
import org.opends.server.types.ByteStringFactory;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
@@ -51,7 +51,6 @@
import static org.opends.server.util.StaticUtils.*;
/**
 * This class defines a Directory Server password storage scheme that will
 * encode values using the RC4 reversible encryption algorithm.  This
opends/src/server/org/opends/server/extensions/TripleDESPasswordStorageScheme.java
@@ -38,7 +38,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.ByteString;
import org.opends.server.types.ByteStringFactory;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
opends/src/server/org/opends/server/replication/protocol/ReplSessionSecurity.java
@@ -30,7 +30,7 @@
import org.opends.server.admin.std.server.ReplicationServerCfg;
import org.opends.server.admin.std.server.ReplicationDomainCfg;
import org.opends.server.types.DirectoryConfig;
import org.opends.server.types.CryptoManager;
import org.opends.server.crypto.CryptoManager;
import org.opends.server.config.ConfigException;
import javax.net.ssl.SSLSocket;
opends/src/server/org/opends/server/types/DirectoryConfig.java
@@ -48,7 +48,7 @@
import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.crypto.CryptoManager;
/**
opends/tests/unit-tests-testng/src/server/org/opends/server/crypto/CryptoManagerTestCase.java
File was renamed from opends/tests/unit-tests-testng/src/server/org/opends/server/types/CryptoManagerTestCase.java
@@ -24,13 +24,14 @@
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.types;
package org.opends.server.crypto;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import org.opends.server.TestCaseUtils;
import org.opends.server.types.*;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.config.ConfigConstants;
@@ -68,8 +69,7 @@
/**
 This class tests the CryptoManager.
 */
public class CryptoManagerTestCase extends TypesTestCase
{
public class CryptoManagerTestCase extends CryptoTestCase {
  /**
   Setup..
   @throws Exception  If an unexpected problem occurs.
opends/tests/unit-tests-testng/src/server/org/opends/server/crypto/CryptoTestCase.java
New file
@@ -0,0 +1,37 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.server.crypto;
import org.testng.annotations.Test;
import org.opends.server.DirectoryServerTestCase;
/**
 * An abstract class that all types unit tests should extend.
 */
@Test(groups = { "precommit", "crypto" }, sequential = true)
public abstract class CryptoTestCase extends DirectoryServerTestCase {}
opends/tests/unit-tests-testng/src/server/org/opends/server/crypto/GetSymmetricKeyExtendedOperationTestCase.java
File was renamed from opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/GetSymmetricKeyExtendedOperationTestCase.java
@@ -25,11 +25,12 @@
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.extensions;
package org.opends.server.crypto;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.opends.server.extensions.ExtensionsTestCase;
import org.opends.server.schema.DirectoryStringSyntax;
import org.opends.server.config.ConfigConstants;
import org.opends.server.types.*;
@@ -49,8 +50,7 @@
 * A set of test cases for the symmetric key extended operation.
 */
public class GetSymmetricKeyExtendedOperationTestCase
     extends ExtensionsTestCase
{
     extends CryptoTestCase {
  /**
   * Ensures that the Directory Server is running.
   *
@@ -73,7 +73,7 @@
    final String cipherTransformationName = "AES/CBC/PKCS5Padding";
    final int cipherKeyLength = 128;
    cm.publishInstanceKeyEntryInADS();
    CryptoManager.publishInstanceKeyEntryInADS();
    // Initial encryption ensures a cipher key entry is in ADS.
    cm.encrypt(cipherTransformationName, cipherKeyLength,