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

david_page
04.31.2007 8dbe6476f37c7f65947ade4aa155e5e59be0bb14
Issue 466 (partial)
CrytoManager
cleanup
3 files modified
37 ■■■■ changed files
opends/src/server/org/opends/server/types/CryptoManager.java 30 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/GetSymmetricKeyExtendedOperationTestCase.java 5 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/types/CryptoManagerTestCase.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/CryptoManager.java
@@ -359,7 +359,8 @@
    // Construct the attribute list.
    final LinkedHashSet<String> requestedAttributes
            = new LinkedHashSet<String>();
    requestedAttributes.add(attrPublicKeyCertificate.getNameOrOID());
    requestedAttributes.add(
            attrPublicKeyCertificate.getNameOrOID() + ";binary");
    // Retrieve the certificate from the entry.
    final InternalClientConnection icc
@@ -369,9 +370,9 @@
      for (int i = 0; i < 2; ++i) {
        try {
          /* If the entry does not exist in the instance's truststore
             backend, add it (which induces the CryptoManager to
             create the public-key certificate attribute), then repeat
             the search. */
             backend, add it using a special object class that induces
             the backend to create the public-key certificate
             attribute, then repeat the search. */
          InternalSearchOperation searchOp = icc.processSearch(
                  entryDN,
                  SearchScope.BASE_OBJECT,
@@ -386,7 +387,6 @@
               the schema */
            certificate = e.getAttributeValue(
                    attrPublicKeyCertificate, BinarySyntax.DECODER);
            break;
          }
          break;
        }
@@ -551,9 +551,13 @@
                attrPublicKeyCertificate,
                ByteStringFactory.create(instanceKeyCertificate));
        certificateValueSet.add(certificateValue);
        final LinkedHashSet<String> certificateOptions =
                new LinkedHashSet<String>(1);
        certificateOptions.add(";binary");
        final Attribute certificateAttr = new Attribute(
                attrPublicKeyCertificate,
                attrPublicKeyCertificate.getNameOrOID(),
                certificateOptions,
                certificateValueSet);
        e.addAttribute(certificateAttr,
                new ArrayList<AttributeValue>(0));
@@ -596,10 +600,10 @@
      // Construct the search filter.
      final String FILTER_OC_INSTANCE_KEY
              = new StringBuilder("(objectclass=")
              .append(ConfigConstants.OC_CRYPTO_INSTANCE_KEY)
              .append(ocInstanceKey.getNameOrOID())
              .append(")").toString();
      final String FILTER_NOT_COMPROMISED = new StringBuilder("(!(")
             .append(ConfigConstants.ATTR_CRYPTO_KEY_COMPROMISED_TIME)
              .append(attrCompromisedTime.getNameOrOID())
              .append("=*))").toString();
      final String searchFilter = new StringBuilder("(&")
              .append(FILTER_OC_INSTANCE_KEY)
@@ -608,9 +612,9 @@
      // Construct the attribute list.
      final LinkedHashSet<String> requestedAttributes
              = new LinkedHashSet<String>();
      requestedAttributes.add(ConfigConstants.ATTR_CRYPTO_KEY_ID);
      requestedAttributes.add(attrKeyID.getNameOrOID());
      requestedAttributes.add(
              attrPublicKeyCertificate.getNameOrOID());
              attrPublicKeyCertificate.getNameOrOID() + ";binary");
      // Invoke the search operation.
      final InternalClientConnection icc
              = InternalClientConnection.getRootConnection();
@@ -2568,7 +2572,7 @@
              keyLengthBits);
      // copy arguments.
      this.fType = new String(transformation);
      this.fType = transformation;
      this.fIVLengthBits = -1; /* compute IV length */
    }
@@ -2616,7 +2620,7 @@
      super(keyID, secretKey, secretKeyLengthBits, isCompromised);
      // copy arguments
      this.fType = new String(transformation);
      this.fType = transformation;
      this.fIVLengthBits = ivLengthBits;
    }
@@ -3000,7 +3004,7 @@
      super(algorithm, keyLengthBits);
      // copy arguments
      this.fType = new String(algorithm);
      this.fType = algorithm;
    }
    /**
@@ -3032,7 +3036,7 @@
      super(keyID, secretKey, secretKeyLengthBits, isCompromised);
      // copy arguments
      this.fType = new String(algorithm);
      this.fType = algorithm;
    }
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/GetSymmetricKeyExtendedOperationTestCase.java
@@ -36,7 +36,6 @@
import org.opends.server.core.ExtendedOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.TimeThread;
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
@@ -77,8 +76,8 @@
    cm.publishInstanceKeyEntryInADS();
    // Initial encryption ensures a cipher key entry is in ADS.
    final byte[] cipherText = cm.encrypt(cipherTransformationName,
            cipherKeyLength, secretMessage.getBytes());
    cm.encrypt(cipherTransformationName, cipherKeyLength,
            secretMessage.getBytes());
    // Retrieve all uncompromised cipher key entries corresponding to the
    // specified transformation and key length.
opends/tests/unit-tests-testng/src/server/org/opends/server/types/CryptoManagerTestCase.java
@@ -172,7 +172,7 @@
    public String getTransformation() {
      if (null == fAlgorithm) return null; // default
      return (null == fMode)
              ? new String(fAlgorithm)
              ? fAlgorithm
              : (new StringBuilder(fAlgorithm)).append("/").append(fMode)
                .append("/").append(fPadding).toString();
    }