From 749d2b9974d93199ff99e74a95fff4e2a63d235e Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Tue, 02 Nov 2010 15:45:49 +0000
Subject: [PATCH] Sync from OpenDS (matthew_swift) Remove Platform class as it is no longer needed. Remove all getter methods which return passwords as Strings. Replace all setter methods which accept passwords as Strings with methods which accept passwords as char arrays, as per Java API security recommendations.

---
 opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ApplicationKeyManager.java                                          |   20 
 opendj-sdk/sdk/src/com/sun/opends/sdk/util/StringPrepProfile.java                                               |   16 
 opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequestImpl.java                                        |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequest.java                                               |   19 
 opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/RDNTestCase.java                                      |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequestImpl.java                               |   24 -
 opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequest.java                                           |    2 
 opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ConnectionFactoryProvider.java                                      |    9 
 opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePlainSASLBindRequestImpl.java                            |    2 
 opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ConnectionFactoryTestCase.java                        |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java                   |   12 
 opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResult.java                                   |   15 
 opendj-sdk/sdk/src/org/opends/sdk/responses/UnmodifiablePasswordModifyExtendedResultImpl.java                   |    7 
 opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/requests/SimpleBindRequestTestCase.java               |    2 
 opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthenticatedConnectionFactory.java                                 |    2 
 opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResultImpl.java                               |   12 
 opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java                          |    2 
 opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/DNTestCase.java                                       |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequestImpl.java                                    |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequest.java                                        |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/Requests.java                                                        |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequest.java                                            |    2 
 opendj-sdk/sdk/examples/org/opends/sdk/examples/client/search/Main.java                                         |    2 
 opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/LDAPListenerTestCase.java                             |    8 
 opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleTest.java |    9 
 opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequest.java                                   |   26 -
 opendj-sdk/sdk/examples/org/opends/sdk/examples/client/asyncsearch/Main.java                                    |    2 
 opendj-sdk/sdk/src/org/opends/sdk/KeyManagers.java                                                              |   16 
 opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableSimpleBindRequestImpl.java                               |    6 
 opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ByteStringTestCase.java                               |   32 +
 opendj-sdk/sdk/src/org/opends/sdk/AbstractConnection.java                                                       |    2 
 opendj-sdk/sdk/src/com/sun/opends/sdk/tools/LDAPPasswordModify.java                                             |    2 
 opendj-sdk/sdk/src/org/opends/sdk/TrustManagers.java                                                            |    6 
 opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequest.java                                          |    2 
 /dev/null                                                                                                       |  834 -----------------------------------------
 opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java                        |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequestImpl.java                                      |    2 
 opendj-sdk/sdk/examples/org/opends/sdk/examples/client/modify/Main.java                                         |    2 
 opendj-sdk/sdk/src/org/opends/sdk/ByteString.java                                                               |   42 ++
 opendj-sdk/sdk/src/org/opends/sdk/Connection.java                                                               |    2 
 opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthRate.java                                                       |   10 
 opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequestImpl.java                                       |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableGSSAPISASLBindRequestImpl.java                           |    2 
 opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequestImpl.java                                           |   14 
 44 files changed, 153 insertions(+), 1,032 deletions(-)

diff --git a/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/asyncsearch/Main.java b/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/asyncsearch/Main.java
index 00b3f33..9c727d4 100644
--- a/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/asyncsearch/Main.java
+++ b/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/asyncsearch/Main.java
@@ -116,7 +116,7 @@
       Main.connection = connection;
 
       final BindRequest request = Requests.newSimpleBindRequest(userName,
-          password);
+          password.toCharArray());
       connection.bind(request, new BindResultHandlerImpl());
     }
 
diff --git a/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/modify/Main.java b/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/modify/Main.java
index 6968f5e..b0f7df1 100644
--- a/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/modify/Main.java
+++ b/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/modify/Main.java
@@ -108,7 +108,7 @@
     try
     {
       connection = factory.getConnection();
-      connection.bind(userName, password);
+      connection.bind(userName, password.toCharArray());
 
       // Write the changes.
       final ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(
diff --git a/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/search/Main.java b/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/search/Main.java
index 8809bcd..4485730 100644
--- a/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/search/Main.java
+++ b/opendj-sdk/sdk/examples/org/opends/sdk/examples/client/search/Main.java
@@ -120,7 +120,7 @@
     try
     {
       connection = factory.getConnection();
-      connection.bind(userName, password);
+      connection.bind(userName, password.toCharArray());
 
       // Read the entries and output them as LDIF.
       final ConnectionEntryReader reader = connection.search(baseDN, scope,
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ApplicationKeyManager.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ApplicationKeyManager.java
index ca919e9..b58578e 100755
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ApplicationKeyManager.java
+++ b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ApplicationKeyManager.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008-2009 Sun Microsystems, Inc.
+ *      Copyright 2008-2010 Sun Microsystems, Inc.
  *      Portions Copyright 2009 Parametric Technology Corporation (PTC)
  */
 
@@ -41,8 +41,6 @@
 import javax.net.ssl.TrustManagerFactory;
 import javax.net.ssl.X509KeyManager;
 
-import com.sun.opends.sdk.util.Platform;
-
 
 
 /**
@@ -88,13 +86,17 @@
 
     // Handle IBM specific cases if the user did not specify a algorithm
     // and/or provider.
-    if (userSpecifiedAlgo == null && Platform.isVendor("IBM"))
+    final String vendor = System.getProperty("java.vendor");
+    if (vendor.startsWith("IBM"))
     {
-      userSpecifiedAlgo = "IbmX509";
-    }
-    if (userSpecifiedProvider == null && Platform.isVendor("IBM"))
-    {
-      userSpecifiedProvider = "IBMJSSE2";
+      if (userSpecifiedAlgo == null)
+      {
+        userSpecifiedAlgo = "IbmX509";
+      }
+      if (userSpecifiedProvider == null)
+      {
+        userSpecifiedProvider = "IBMJSSE2";
+      }
     }
 
     // Have some fallbacks to choose the provider and algorith of the
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthRate.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthRate.java
index e6a4890..37cb397 100644
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthRate.java
+++ b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthRate.java
@@ -212,7 +212,7 @@
           if(successRecentCount.get() * ((float)invalidCredPercent/100) >
               invalidCredRecentCount.get())
           {
-            sbr.setPassword("invalid-password");
+            sbr.setPassword("invalid-password".toCharArray());
           }
           else
           {
@@ -244,7 +244,7 @@
           if(successRecentCount.get() * ((float)invalidCredPercent/100) >
               invalidCredRecentCount.get())
           {
-            sbr.setPassword("invalid-password");
+            sbr.setPassword("invalid-password".toCharArray());
           }
           else
           {
@@ -268,7 +268,7 @@
           if(successRecentCount.get() * ((float)invalidCredPercent/100) >
               invalidCredRecentCount.get())
           {
-            sbr.setPassword("invalid-password");
+            sbr.setPassword("invalid-password".toCharArray());
           }
           else
           {
@@ -300,7 +300,7 @@
           if(successRecentCount.get() * ((float)invalidCredPercent/100) >
               invalidCredRecentCount.get())
           {
-            sbr.setPassword("invalid-password");
+            sbr.setPassword("invalid-password".toCharArray());
           }
           else
           {
@@ -346,7 +346,7 @@
           if(successRecentCount.get() * ((float)invalidCredPercent/100) >
               invalidCredRecentCount.get())
           {
-            sbr.setPassword("invalid-password");
+            sbr.setPassword("invalid-password".toCharArray());
           }
           else
           {
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthenticatedConnectionFactory.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthenticatedConnectionFactory.java
index 6dcf1ea..4735781 100644
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthenticatedConnectionFactory.java
+++ b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/AuthenticatedConnectionFactory.java
@@ -249,7 +249,7 @@
      * method will always throw {@code UnsupportedOperationException}.
      */
     @Override
-    public BindResult bind(final String name, final String password)
+    public BindResult bind(final String name, final char[] password)
         throws UnsupportedOperationException
     {
       throw new UnsupportedOperationException();
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ConnectionFactoryProvider.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ConnectionFactoryProvider.java
index 34324e6..3390a64 100644
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ConnectionFactoryProvider.java
+++ b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ConnectionFactoryProvider.java
@@ -594,8 +594,8 @@
         if (bindNameArg.isPresent() || bindPasswordFileArg.isPresent()
             || bindPasswordArg.isPresent())
         {
-          bindRequest =
-              Requests.newSimpleBindRequest(getBindName(), getPassword());
+          bindRequest = Requests.newSimpleBindRequest(getBindName(),
+              getPassword().toCharArray());
         }
       }
       else if (mech.equals(DigestMD5SASLBindRequest.SASL_MECHANISM_NAME))
@@ -836,13 +836,14 @@
     {
       tm = TrustManagers.checkValidityDates(TrustManagers.checkHostName(
           hostNameArg.getValue(), TrustManagers.checkUsingTrustStore(
-              trustStorePathArg.getValue(), getTrustStorePIN(), null)));
+              trustStorePathArg.getValue(), getTrustStorePIN().toCharArray(),
+              null)));
     }
     else if (getTrustStore() != null)
     {
       tm = TrustManagers.checkValidityDates(TrustManagers.checkHostName(
           hostNameArg.getValue(), TrustManagers.checkUsingTrustStore(
-              getTrustStore(), getTrustStorePIN(), null)));
+              getTrustStore(), getTrustStorePIN().toCharArray(), null)));
     }
 
     if (app != null && !app.isQuiet())
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/LDAPPasswordModify.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/LDAPPasswordModify.java
index 3c960fb..2e27060 100644
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/LDAPPasswordModify.java
+++ b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/LDAPPasswordModify.java
@@ -488,7 +488,7 @@
     if (result.getGeneratedPassword() != null)
     {
       message = INFO_LDAPPWMOD_GENERATED_PASSWORD.get(result
-          .getGeneratedPasswordAsString());
+          .getGeneratedPassword().toString());
       println(message);
     }
 
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/Platform.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/util/Platform.java
deleted file mode 100644
index 5d57501..0000000
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/Platform.java
+++ /dev/null
@@ -1,834 +0,0 @@
-/*
- * 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
- *
- *
- *      Copyright 2009 Sun Microsystems, Inc.
- */
-
-package com.sun.opends.sdk.util;
-
-
-
-import static com.sun.opends.sdk.messages.Messages.*;
-
-import java.io.*;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.security.*;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-
-import org.opends.sdk.LocalizableMessage;
-
-
-
-/**
- * Provides a wrapper class that collects all of the JVM vendor and JDK version
- * specific code in a single place.
- */
-public final class Platform
-{
-
-  /**
-   * Default platform class.
-   */
-  private static class DefaultPlatformIMPL extends PlatformIMPL
-  {
-    // normalize method.
-    private static final Method NORMALIZE;
-    // Normalized form method.
-    private static final Object FORM_NFKC;
-
-    static
-    {
-
-      Method normalize = null;
-      Object formNFKC = null;
-      try
-      {
-        final Class<?> normalizer = Class.forName("java.text.Normalizer");
-        final Class<?> normalizerForm = Class
-            .forName("java.text.Normalizer$Form");
-        normalize = normalizer.getMethod("normalize", CharSequence.class,
-            normalizerForm);
-        formNFKC = normalizerForm.getField("NFKD").get(null);
-      }
-      catch (final Exception ex)
-      {
-        // Do not use Normalizer. The values are already set to null.
-      }
-      NORMALIZE = normalize;
-      FORM_NFKC = formNFKC;
-    }
-
-
-
-    @Override
-    public void normalize(final StringBuilder buffer)
-    {
-      try
-      {
-        final String normal = (String) NORMALIZE
-            .invoke(null, buffer, FORM_NFKC);
-        buffer.replace(0, buffer.length(), normal);
-      }
-      catch (final Exception ex)
-      {
-        // Don't do anything. buffer should be used.
-      }
-    }
-  }
-
-
-
-  /**
-   * IBM JDK 5 platform class.
-   */
-  private static class IBM5PlatformIMPL extends PlatformIMPL
-  {
-
-    @Override
-    public void normalize(final StringBuilder buffer)
-    {
-      // No implementation.
-    }
-  }
-
-
-
-  /**
-   * Platform base class. Performs all of the certificate management functions.
-   */
-  private abstract static class PlatformIMPL
-  {
-
-    // Key size, key algorithm and signature algorithms used.
-    private static final int KEY_SIZE = 1024;
-    private static final String KEY_ALGORITHM = "rsa";
-    private static final String SIG_ALGORITHM = "SHA1WithRSA";
-
-    // Time values used in validity calculations.
-    private static final int SEC_IN_DAY = 24 * 60 * 60;
-    private static final int DEFAULT_VALIDITY = 90 * SEC_IN_DAY;
-
-    // These two are used to build certificate request files.
-    private static final String TMPFILE_PREFIX = "CertificateManager-";
-    private static final String TMPFILE_EXT = ".csr";
-
-    // Methods pulled from the classes.
-    private static final String ENCODE_SIGN_METHOD = "encodeAndSign";
-    private static final String GENERATE_METHOD = "generate";
-    private static final String GET_PRIVATE_KEY_METHOD = "getPrivateKey";
-    private static final String GET_SELFSIGNED_CERT_METHOD = "getSelfCertificate";
-    private static final String PRINT_METHOD = "print";
-
-    // Classes needed to manage certificates.
-    private static Class<?> certKeyGenClass, x500NameClass, x500SignerClass,
-        pkcs10Class;
-
-    // Constructors for each of the above classes.
-    private static Constructor<?> certKeyGenCons, x500NameCons, x500SignerCons,
-        pkcs10Cons;
-
-    static
-    {
-      final String x509pkg = pkgPrefix + ".x509";
-      final String pkcs10Pkg = pkgPrefix + ".pkcs";
-      final String certAndKeyGen = x509pkg + ".CertAndKeyGen";
-      final String x500Name = x509pkg + ".X500Name";
-      final String x500Signer = x509pkg + ".X500Signer";
-      try
-      {
-        certKeyGenClass = Class.forName(certAndKeyGen);
-        x500NameClass = Class.forName(x500Name);
-        x500SignerClass = Class.forName(x500Signer);
-        if (certReqAllowed)
-        {
-          final String pkcs10 = pkcs10Pkg + ".PKCS10";
-          pkcs10Class = Class.forName(pkcs10);
-          pkcs10Cons = pkcs10Class.getConstructor(PublicKey.class);
-        }
-        certKeyGenCons = certKeyGenClass.getConstructor(String.class,
-            String.class);
-        x500NameCons = x500NameClass.getConstructor(String.class);
-        x500SignerCons = x500SignerClass.getConstructor(Signature.class,
-            x500NameClass);
-      }
-      catch (final ClassNotFoundException e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_CLASS_NOT_FOUND.get(e
-            .getMessage());
-        throw new ExceptionInInitializerError(msg.toString());
-      }
-      catch (final SecurityException e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_SECURITY.get(e.getMessage());
-        throw new ExceptionInInitializerError(msg.toString());
-      }
-      catch (final NoSuchMethodException e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_NO_METHOD
-            .get(e.getMessage());
-        throw new ExceptionInInitializerError(msg.toString());
-      }
-    }
-
-
-
-    protected PlatformIMPL()
-    {
-    }
-
-
-
-    /**
-     * Add the certificate in the specified path to the specified keystore,
-     * creating the keystore using the specified type and path if it the
-     * keystore doesn't exist.
-     *
-     * @param ks
-     *          The keystore to add the certificate to, may be null if it
-     *          doesn't exist.
-     * @param ksType
-     *          The type to use if the keystore is created.
-     * @param ksPath
-     *          The path to the keystore if it is created.
-     * @param alias
-     *          The alias to store the certificate under.
-     * @param pwd
-     *          The password to use in saving the certificate.
-     * @param certPath
-     *          The path to the file containing the certificate.
-     * @throws KeyStoreException
-     *           If an error occurred adding the certificate to the keystore.
-     */
-    public final void addCertificate(KeyStore ks, final String ksType,
-        final String ksPath, final String alias, final char[] pwd,
-        final String certPath) throws KeyStoreException
-    {
-      try
-      {
-        final CertificateFactory cf = CertificateFactory.getInstance("X509");
-        final InputStream inStream = new FileInputStream(certPath);
-        if (ks == null)
-        {
-          ks = KeyStore.getInstance(ksType);
-          ks.load(null, pwd);
-        }
-        // Do not support certificate replies.
-        if (ks.entryInstanceOf(alias, KeyStore.PrivateKeyEntry.class))
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_CERT_REPLIES_INVALID
-              .get(alias);
-          throw new KeyStoreException(msg.toString());
-        }
-        else if (!ks.containsAlias(alias)
-            || ks
-                .entryInstanceOf(alias, KeyStore.TrustedCertificateEntry.class))
-        {
-          trustedCert(alias, cf, ks, inStream);
-        }
-        else
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_ALIAS_INVALID.get(alias);
-          throw new KeyStoreException(msg.toString());
-        }
-        final FileOutputStream fileOutStream = new FileOutputStream(ksPath);
-        ks.store(fileOutStream, pwd);
-        fileOutStream.close();
-        inStream.close();
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_ADD_CERT.get(alias, e
-            .getMessage());
-        throw new KeyStoreException(msg.toString());
-      }
-    }
-
-
-
-    /**
-     * Delete the specified alias from the specified keystore.
-     *
-     * @param ks
-     *          The keystore to delete the alias from.
-     * @param ksPath
-     *          The path to the keystore.
-     * @param alias
-     *          The alias to use in the request generation.
-     * @param pwd
-     *          The keystore password to use.
-     * @throws KeyStoreException
-     *           If an error occurred deleting the alias.
-     */
-    public final void deleteAlias(final KeyStore ks, final String ksPath,
-        final String alias, final char[] pwd) throws KeyStoreException
-    {
-      try
-      {
-        if (ks == null)
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_KEYSTORE_NONEXISTANT.get();
-          throw new KeyStoreException(msg.toString());
-        }
-        ks.deleteEntry(alias);
-        final FileOutputStream fs = new FileOutputStream(ksPath);
-        ks.store(fs, pwd);
-        fs.close();
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_DELETE_ALIAS.get(alias, e
-            .getMessage());
-        throw new KeyStoreException(msg.toString());
-      }
-    }
-
-
-
-    /**
-     * Generate a certificate request. Note that this methods checks if the
-     * certificate request generation is allowed and throws an exception if it
-     * isn't supported. Some vendors JDKs aren't compatible with Sun's
-     * certificate request generation classes so they aren't supported.
-     *
-     * @param ks
-     *          The keystore to use in the request creation.
-     * @param ksType
-     *          The keystore type.
-     * @param ksPath
-     *          The path to the keystore.
-     * @param alias
-     *          The alias to use in the request generation.
-     * @param pwd
-     *          The keystore password to use.
-     * @param dn
-     *          A dn string to use as the certificate subject.
-     * @return A file object pointing at the created certificate request.
-     * @throws KeyStoreException
-     *           If the certificate request failed.
-     */
-    public final File generateCertificateRequest(final KeyStore ks,
-        final String ksType, final String ksPath, final String alias,
-        final char[] pwd, final String dn) throws KeyStoreException
-    {
-      if (!certReqAllowed)
-      {
-        final String vendor = System.getProperty("java.vendor");
-        final LocalizableMessage msg = ERR_CERTMGR_CERT_SIGN_REQ_NOT_SUPPORTED
-            .get(vendor);
-        throw new KeyStoreException(msg.toString());
-      }
-      final KeyStore keyStore = generateSelfSignedCertificate(ks, ksType,
-          ksPath, alias, pwd, dn, DEFAULT_VALIDITY);
-      File csrFile;
-      try
-      {
-        csrFile = File.createTempFile(TMPFILE_PREFIX, TMPFILE_EXT);
-        csrFile.deleteOnExit();
-        final PrintStream printStream = new PrintStream(new FileOutputStream(
-            csrFile.getAbsolutePath()));
-        if (keyStore == null)
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_KEYSTORE_NONEXISTANT.get();
-          throw new KeyStoreException(msg.toString());
-        }
-        final PrivateKey privateKey = getPrivateKey(keyStore, alias, pwd);
-        if (privateKey == null)
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_PRIVATE_KEY.get(alias);
-          throw new KeyStoreException(msg.toString());
-        }
-        final Certificate cert = keyStore.getCertificate(alias);
-        if (cert == null)
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_ALIAS_NO_CERTIFICATE
-              .get(alias);
-          throw new KeyStoreException(msg.toString());
-        }
-        final Signature signature = Signature.getInstance(SIG_ALGORITHM);
-        signature.initSign(privateKey);
-        final Object request = pkcs10Cons.newInstance(cert.getPublicKey());
-        final Object subject = x500NameCons.newInstance(dn);
-        final Object signer = x500SignerCons.newInstance(signature, subject);
-        final Method encodeAndSign = pkcs10Class.getMethod(ENCODE_SIGN_METHOD,
-            x500SignerClass);
-        final Method print = pkcs10Class.getMethod(PRINT_METHOD,
-            PrintStream.class);
-        encodeAndSign.invoke(request, signer);
-        print.invoke(request, printStream);
-        printStream.close();
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_CERT_REQUEST.get(alias, e
-            .getMessage());
-        throw new KeyStoreException(msg.toString());
-      }
-      return csrFile;
-    }
-
-
-
-    /**
-     * Generate a self-signed certificate using the specified alias, dn string
-     * and validity period. If the keystore does not exist, create it using the
-     * specified type and path.
-     *
-     * @param ks
-     *          The keystore to save the certificate in. May be null if it does
-     *          not exist.
-     * @param ksType
-     *          The keystore type to use if the keystore is created.
-     * @param ksPath
-     *          The path to the keystore if the keystore is created.
-     * @param alias
-     *          The alias to store the certificate under.
-     * @param pwd
-     *          The password to us in saving the certificate.
-     * @param dn
-     *          The dn string used as the certificate subject.
-     * @param validity
-     *          The validity of the certificate in days.
-     * @return The keystore that the self-signed certificate was stored in.
-     * @throws KeyStoreException
-     *           If the self-signed certificate cannot be generated.
-     */
-    public final KeyStore generateSelfSignedCertificate(KeyStore ks,
-        final String ksType, final String ksPath, final String alias,
-        final char[] pwd, final String dn, final int validity)
-        throws KeyStoreException
-    {
-      try
-      {
-        if (ks == null)
-        {
-          ks = KeyStore.getInstance(ksType);
-          ks.load(null, pwd);
-        }
-        else if (ks.containsAlias(alias))
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_ALIAS_ALREADY_EXISTS
-              .get(alias);
-          throw new KeyStoreException(msg.toString());
-        }
-        final Object keypair = certKeyGenCons.newInstance(KEY_ALGORITHM,
-            SIG_ALGORITHM);
-        final Object subject = x500NameCons.newInstance(dn);
-        final Method certAndKeyGenGenerate = certKeyGenClass.getMethod(
-            GENERATE_METHOD, int.class);
-        certAndKeyGenGenerate.invoke(keypair, KEY_SIZE);
-        final Method certAndKeyGetPrivateKey = certKeyGenClass
-            .getMethod(GET_PRIVATE_KEY_METHOD);
-        final PrivateKey privatevKey = (PrivateKey) certAndKeyGetPrivateKey
-            .invoke(keypair);
-        final Certificate[] certificateChain = new Certificate[1];
-        final Method getSelfCertificate = certKeyGenClass.getMethod(
-            GET_SELFSIGNED_CERT_METHOD, x500NameClass, long.class);
-        final int days = validity * SEC_IN_DAY;
-        certificateChain[0] = (Certificate) getSelfCertificate.invoke(keypair,
-            subject, days);
-        ks.setKeyEntry(alias, privatevKey, pwd, certificateChain);
-        final FileOutputStream fileOutStream = new FileOutputStream(ksPath);
-        ks.store(fileOutStream, pwd);
-        fileOutStream.close();
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_GEN_SELF_SIGNED_CERT.get(
-            alias, e.getMessage());
-        throw new KeyStoreException(msg.toString());
-      }
-      return ks;
-    }
-
-
-
-    /**
-     * Normalize the data in the specified buffer.
-     *
-     * @param buffer
-     *          The buffer to normalize.
-     */
-    public abstract void normalize(StringBuilder buffer);
-
-
-
-    /**
-     * Returns the private key associated with specified alias and keystore. The
-     * keystore was already checked for existance.
-     *
-     * @param ks
-     *          The keystore to get the private key from, it must exist.
-     * @param alias
-     *          The alias to get the private key of.
-     * @param pwd
-     *          The password used to get the key from the keystore.
-     * @return The private key of related to the alias.
-     * @throws KeyStoreException
-     *           If the alias is not in the keystore, the entry related to the
-     *           alias is not of
-     */
-    private PrivateKey getPrivateKey(final KeyStore ks, final String alias,
-        final char[] pwd) throws KeyStoreException
-    {
-      PrivateKey key = null;
-      try
-      {
-        if (!ks.containsAlias(alias))
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_ALIAS_DOES_NOT_EXIST
-              .get(alias);
-          throw new KeyStoreException(msg.toString());
-        }
-        if (!ks.entryInstanceOf(alias, KeyStore.PrivateKeyEntry.class)
-            && !ks.entryInstanceOf(alias, KeyStore.SecretKeyEntry.class))
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_ALIAS_INVALID_ENTRY_TYPE
-              .get(alias);
-          throw new KeyStoreException(msg.toString());
-        }
-        key = (PrivateKey) ks.getKey(alias, pwd);
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_GET_KEY.get(alias, e
-            .getMessage());
-        throw new KeyStoreException(msg.toString());
-      }
-      return key;
-    }
-
-
-
-    /**
-     * Check that the issuer and subject DNs match.
-     *
-     * @param cert
-     *          The certificate to examine.
-     * @return {@code true} if the certificate is self-signed.
-     */
-    private boolean isSelfSigned(final X509Certificate cert)
-    {
-      return cert.getSubjectDN().equals(cert.getIssuerDN());
-    }
-
-
-
-    /**
-     * Generate a x509 certificate from the input stream. Verification is done
-     * only if it is self-signed.
-     *
-     * @param alias
-     *          The alias to save the certificate under.
-     * @param cf
-     *          The x509 certificate factory.
-     * @param ks
-     *          The keystore to add the certificate in.
-     * @param in
-     *          The input stream to read the certificate from.
-     * @throws KeyStoreException
-     *           If the alias exists already in the keystore, if the self-signed
-     *           certificate didn't verify, or the certificate could not be
-     *           stored.
-     */
-    private void trustedCert(final String alias, final CertificateFactory cf,
-        final KeyStore ks, final InputStream in) throws KeyStoreException
-    {
-      try
-      {
-        if (ks.containsAlias(alias) == true)
-        {
-          final LocalizableMessage msg = ERR_CERTMGR_ALIAS_ALREADY_EXISTS
-              .get(alias);
-          throw new KeyStoreException(msg.toString());
-        }
-        final X509Certificate cert = (X509Certificate) cf
-            .generateCertificate(in);
-        if (isSelfSigned(cert))
-        {
-          cert.verify(cert.getPublicKey());
-        }
-        ks.setCertificateEntry(alias, cert);
-      }
-      catch (final Exception e)
-      {
-        final LocalizableMessage msg = ERR_CERTMGR_TRUSTED_CERT.get(alias, e
-            .getMessage());
-        throw new KeyStoreException(msg.toString());
-      }
-    }
-  }
-
-
-
-  /**
-   * Sun 5 JDK platform class.
-   */
-  private static class Sun5PlatformIMPL extends PlatformIMPL
-  {
-    // normalize method.
-    private static final Method NORMALIZE;
-    // Normalized form method.
-    private static final Object FORM_NFKC;
-
-    static
-    {
-      Method normalize = null;
-      Object formNFKC = null;
-      try
-      {
-        final Class<?> normalizer = Class.forName("sun.text.Normalizer");
-        formNFKC = normalizer.getField("DECOMP_COMPAT").get(null);
-        final Class<?> normalizerForm = Class
-            .forName("sun.text.Normalizer$Mode");
-        normalize = normalizer.getMethod("normalize", String.class,
-            normalizerForm, Integer.TYPE);
-      }
-      catch (final Exception ex)
-      {
-        // Do not use Normalizer. The values are already set to null.
-      }
-      NORMALIZE = normalize;
-      FORM_NFKC = formNFKC;
-    }
-
-
-
-    @Override
-    public void normalize(final StringBuilder buffer)
-    {
-      try
-      {
-        final String normal = (String) NORMALIZE.invoke(null,
-            buffer.toString(), FORM_NFKC, 0);
-        buffer.replace(0, buffer.length(), normal);
-      }
-      catch (final Exception ex)
-      {
-        // Don't do anything. buffer should be used.
-      }
-    }
-  }
-
-
-
-  // Prefix that determines which security package to use.
-  private static String pkgPrefix;
-
-  // IBM security package doesn't appear to support PCKS10, this flags turns
-  // off support for that.
-  private static boolean certReqAllowed;
-
-  // The two security package prefixes (IBM and SUN).
-  private static final String IBM_SEC = "com.ibm.security";
-
-  private static final String SUN_SEC = "sun.security";
-
-  private static final PlatformIMPL IMPL;
-
-  static
-  {
-    final String vendor = System.getProperty("java.vendor");
-    final String ver = System.getProperty("java.version");
-
-    if (vendor.startsWith("IBM"))
-    {
-      pkgPrefix = IBM_SEC;
-      certReqAllowed = false;
-      if (ver.startsWith("1.5"))
-      {
-        IMPL = new IBM5PlatformIMPL();
-      }
-      else
-      {
-        IMPL = new DefaultPlatformIMPL();
-      }
-    }
-    else
-    {
-      pkgPrefix = SUN_SEC;
-      certReqAllowed = true;
-      if (ver.startsWith("1.5"))
-      {
-        IMPL = new Sun5PlatformIMPL();
-      }
-      else
-      {
-        IMPL = new DefaultPlatformIMPL();
-      }
-    }
-  }
-
-
-
-  /**
-   * Add the certificate in the specified path to the provided keystore;
-   * creating the keystore with the provided type and path if it doesn't exist.
-   *
-   * @param ks
-   *          The keystore to add the certificate to, may be null if it doesn't
-   *          exist.
-   * @param ksType
-   *          The type to use if the keystore is created.
-   * @param ksPath
-   *          The path to the keystore if it is created.
-   * @param alias
-   *          The alias to store the certificate under.
-   * @param pwd
-   *          The password to use in saving the certificate.
-   * @param certPath
-   *          The path to the file containing the certificate.
-   * @throws KeyStoreException
-   *           If an error occurred adding the certificate to the keystore.
-   */
-  public static void addCertificate(final KeyStore ks, final String ksType,
-      final String ksPath, final String alias, final char[] pwd,
-      final String certPath) throws KeyStoreException
-  {
-    IMPL.addCertificate(ks, ksType, ksPath, alias, pwd, certPath);
-  }
-
-
-
-  /**
-   * Delete the specified alias from the provided keystore.
-   *
-   * @param ks
-   *          The keystore to delete the alias from.
-   * @param ksPath
-   *          The path to the keystore.
-   * @param alias
-   *          The alias to use in the request generation.
-   * @param pwd
-   *          The keystore password to use.
-   * @throws KeyStoreException
-   *           If an error occurred deleting the alias.
-   */
-  public static void deleteAlias(final KeyStore ks, final String ksPath,
-      final String alias, final char[] pwd) throws KeyStoreException
-  {
-    IMPL.deleteAlias(ks, ksPath, alias, pwd);
-  }
-
-
-
-  /**
-   * Generate a certificate request using the specified parameters.
-   *
-   * @param ks
-   *          The keystore to use in the request creation.
-   * @param ksType
-   *          The keystore type.
-   * @param ksPath
-   *          The path to the keystore.
-   * @param alias
-   *          The alias to use in the request generation.
-   * @param pwd
-   *          The keystore password to use.
-   * @param dn
-   *          A dn string to use as the certificate subject.
-   * @return A file object pointing at the created certificate request.
-   * @throws KeyStoreException
-   *           If the certificate request failed.
-   */
-  public static File generateCertificateRequest(final KeyStore ks,
-      final String ksType, final String ksPath, final String alias,
-      final char[] pwd, final String dn) throws KeyStoreException
-  {
-    return IMPL.generateCertificateRequest(ks, ksType, ksPath, alias, pwd, dn);
-  }
-
-
-
-  /**
-   * Generate a self-signed certificate using the specified alias, dn string and
-   * validity period. If the keystore does not exist, it will be created using
-   * the specified keystore type and path.
-   *
-   * @param ks
-   *          The keystore to save the certificate in. May be null if it does
-   *          not exist.
-   * @param ksType
-   *          The keystore type to use if the keystore is created.
-   * @param ksPath
-   *          The path to the keystore if the keystore is created.
-   * @param alias
-   *          The alias to store the certificate under.
-   * @param pwd
-   *          The password to us in saving the certificate.
-   * @param dn
-   *          The dn string used as the certificate subject.
-   * @param validity
-   *          The validity of the certificate in days.
-   * @throws KeyStoreException
-   *           If the self-signed certificate cannot be generated.
-   */
-  public static void generateSelfSignedCertificate(final KeyStore ks,
-      final String ksType, final String ksPath, final String alias,
-      final char[] pwd, final String dn, final int validity)
-      throws KeyStoreException
-  {
-    IMPL.generateSelfSignedCertificate(ks, ksType, ksPath, alias, pwd, dn,
-        validity);
-  }
-
-
-
-  /**
-   * Test if a platform java vendor property starts with the specified vendor
-   * string.
-   *
-   * @param vendor
-   *          The vendor to check for.
-   * @return {@code true} if the java vendor starts with the specified vendor
-   *         string.
-   */
-  public static boolean isVendor(final String vendor)
-  {
-    final String javaVendor = System.getProperty("java.vendor");
-    return javaVendor.startsWith(vendor);
-  }
-
-
-
-  /**
-   * Normalize the specified buffer.
-   *
-   * @param buffer
-   *          The buffer to normalize.
-   */
-  public static void normalize(final StringBuilder buffer)
-  {
-    IMPL.normalize(buffer);
-  }
-
-
-
-  // Prevent instantiation.
-  private Platform()
-  {
-  }
-}
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/StringPrepProfile.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/util/StringPrepProfile.java
index c7fa64e..78d3e39 100644
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/StringPrepProfile.java
+++ b/opendj-sdk/sdk/src/com/sun/opends/sdk/util/StringPrepProfile.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2009 Sun Microsystems, Inc.
+ *      Copyright 2010 Sun Microsystems, Inc.
  */
 package com.sun.opends.sdk.util;
 
@@ -30,6 +30,8 @@
 
 import static com.sun.opends.sdk.util.Validator.ensureNotNull;
 
+import java.text.Normalizer;
+import java.text.Normalizer.Form;
 import java.util.HashMap;
 import java.util.HashSet;
 
@@ -492,7 +494,9 @@
         // Map the attribute value.
         map(buffer, sequence.subSequence(i, length), trim, foldCase);
         // Normalize the attribute value.
-        normalize(buffer);
+        String normalizedForm = Normalizer.normalize(buffer, Form.NFKD);
+        buffer.setLength(0);
+        buffer.append(normalizedForm);
         break;
       }
       int buffLen = buffer.length();
@@ -575,14 +579,6 @@
 
 
 
-  // Normalizes the input string with NFKC Form.
-  private static void normalize(final StringBuilder buffer)
-  {
-    Platform.normalize(buffer);
-  }
-
-
-
   // Prevent instantiation.
   private StringPrepProfile()
   {
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/AbstractConnection.java b/opendj-sdk/sdk/src/org/opends/sdk/AbstractConnection.java
index d4c8ea7..9bd409e 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/AbstractConnection.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/AbstractConnection.java
@@ -147,7 +147,7 @@
   /**
    * {@inheritDoc}
    */
-  public BindResult bind(final String name, final String password)
+  public BindResult bind(final String name, final char[] password)
       throws ErrorResultException, InterruptedException,
       LocalizedIllegalArgumentException, UnsupportedOperationException,
       IllegalStateException, NullPointerException
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/ByteString.java b/opendj-sdk/sdk/src/org/opends/sdk/ByteString.java
index f3f2432..31e50ed 100755
--- a/opendj-sdk/sdk/src/org/opends/sdk/ByteString.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/ByteString.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2009 Sun Microsystems, Inc.
+ *      Copyright 2009-2010 Sun Microsystems, Inc.
  */
 package org.opends.sdk;
 
@@ -30,6 +30,9 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
 import java.util.logging.Level;
 
 import com.sun.opends.sdk.util.StaticUtils;
@@ -144,6 +147,26 @@
 
 
   /**
+   * Returns a byte string containing the UTF-8 encoded bytes of the provided
+   * char array.
+   *
+   * @param chars
+   *          The char array to use.
+   * @return A byte string containing the UTF-8 encoded bytes of the provided
+   *         char array.
+   */
+  public static ByteString valueOf(final char[] chars)
+  {
+    Charset utf8 = Charset.forName("UTF-8");
+    ByteBuffer buffer = utf8.encode(CharBuffer.wrap(chars));
+    byte[] bytes = new byte[buffer.remaining()];
+    buffer.get(bytes);
+    return wrap(bytes);
+  }
+
+
+
+  /**
    * Returns a byte string that wraps the provided byte array.
    * <p>
    * <b>NOTE:</b> this method takes ownership of the provided byte array and,
@@ -613,6 +636,23 @@
 
 
   /**
+   * Returns the UTF-8 decoded char array representation of this byte sequence.
+   *
+   * @return The UTF-8 decoded char array representation of this byte sequence.
+   */
+  public char[] toCharArray()
+  {
+    Charset utf8 = Charset.forName("UTF-8");
+    CharBuffer charBuffer = utf8
+        .decode(ByteBuffer.wrap(buffer, offset, length));
+    char[] chars = new char[charBuffer.remaining()];
+    charBuffer.get(chars);
+    return chars;
+  }
+
+
+
+  /**
    * Returns the integer value represented by the first four bytes of this byte
    * string in big-endian order.
    *
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/Connection.java b/opendj-sdk/sdk/src/org/opends/sdk/Connection.java
index c5fab52..542be35 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/Connection.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/Connection.java
@@ -249,7 +249,7 @@
    * @throws NullPointerException
    *           If {@code name} or {@code password} was {@code null}.
    */
-  BindResult bind(String name, String password) throws ErrorResultException,
+  BindResult bind(String name, char[] password) throws ErrorResultException,
       InterruptedException, LocalizedIllegalArgumentException,
       UnsupportedOperationException, IllegalStateException,
       NullPointerException;
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/KeyManagers.java b/opendj-sdk/sdk/src/org/opends/sdk/KeyManagers.java
index ecd45ea..4d2322f 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/KeyManagers.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/KeyManagers.java
@@ -267,14 +267,12 @@
    *           If {@code file} was {@code null}.
    */
   public static X509KeyManager useKeyStoreFile(final String file,
-      final String password, final String format)
+      final char[] password, final String format)
       throws GeneralSecurityException, IOException, NullPointerException
   {
     Validator.ensureNotNull(file);
 
     final File keyStoreFile = new File(file);
-    final char[] keyStorePassword = password != null ? password.toCharArray()
-        : null;
     final String keyStoreFormat = format != null ? format : KeyStore
         .getDefaultType();
 
@@ -284,7 +282,7 @@
     try
     {
       fos = new FileInputStream(keyStoreFile);
-      keyStore.load(fos, keyStorePassword);
+      keyStore.load(fos, password);
     }
     finally
     {
@@ -303,7 +301,7 @@
 
     final KeyManagerFactory kmf = KeyManagerFactory
         .getInstance(KeyManagerFactory.getDefaultAlgorithm());
-    kmf.init(keyStore, keyStorePassword);
+    kmf.init(keyStore, password);
 
     X509KeyManager x509km = null;
     for (final KeyManager km : kmf.getKeyManagers())
@@ -340,16 +338,14 @@
    * @throws IOException
    *           If the PKCS#11 token could not be found or could not be read.
    */
-  public static X509KeyManager usePKCS11Token(final String password)
+  public static X509KeyManager usePKCS11Token(final char[] password)
       throws GeneralSecurityException, IOException
   {
-    final char[] keyStorePassword = password != null ? password.toCharArray()
-        : null;
     final KeyStore keyStore = KeyStore.getInstance("PKCS11");
-    keyStore.load(null, keyStorePassword);
+    keyStore.load(null, password);
     final KeyManagerFactory kmf = KeyManagerFactory
         .getInstance(KeyManagerFactory.getDefaultAlgorithm());
-    kmf.init(keyStore, keyStorePassword);
+    kmf.init(keyStore, password);
 
     X509KeyManager x509km = null;
     for (final KeyManager km : kmf.getKeyManagers())
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/TrustManagers.java b/opendj-sdk/sdk/src/org/opends/sdk/TrustManagers.java
index 1453851..963737b 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/TrustManagers.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/TrustManagers.java
@@ -442,14 +442,12 @@
    *           If {@code file} was {@code null}.
    */
   public static X509TrustManager checkUsingTrustStore(final String file,
-      final String password, final String format)
+      final char[] password, final String format)
       throws GeneralSecurityException, IOException, NullPointerException
   {
     Validator.ensureNotNull(file);
 
     final File trustStoreFile = new File(file);
-    final char[] trustStorePassword = password != null ? password.toCharArray()
-        : null;
     final String trustStoreFormat = format != null ? format : KeyStore
         .getDefaultType();
 
@@ -459,7 +457,7 @@
     try
     {
       fos = new FileInputStream(trustStoreFile);
-      keyStore.load(fos, trustStorePassword);
+      keyStore.load(fos, password);
     }
     finally
     {
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequest.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequest.java
index 8136b3c..a466c92 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequest.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequest.java
@@ -195,7 +195,7 @@
    * @throws NullPointerException
    *           If {@code password} was {@code null}.
    */
-  CRAMMD5SASLBindRequest setPassword(String password)
+  CRAMMD5SASLBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException;
 
 }
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequestImpl.java
index dfdc74c..afd03da 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/CRAMMD5SASLBindRequestImpl.java
@@ -256,7 +256,7 @@
   /**
    * {@inheritDoc}
    */
-  public CRAMMD5SASLBindRequest setPassword(final String password)
+  public CRAMMD5SASLBindRequest setPassword(final char[] password)
       throws NullPointerException
   {
     Validator.ensureNotNull(password);
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequest.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequest.java
index f5363e5..eea5692 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequest.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequest.java
@@ -508,7 +508,7 @@
    * @throws NullPointerException
    *           If {@code password} was {@code null}.
    */
-  DigestMD5SASLBindRequest setPassword(String password)
+  DigestMD5SASLBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException;
 
 
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequestImpl.java
index 7b08145..8873c6b 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/DigestMD5SASLBindRequestImpl.java
@@ -596,7 +596,7 @@
    * {@inheritDoc}
    */
   @Override
-  public DigestMD5SASLBindRequest setPassword(final String password)
+  public DigestMD5SASLBindRequest setPassword(final char[] password)
       throws NullPointerException
   {
     Validator.ensureNotNull(password);
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequest.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequest.java
index cac8583..a121cd0 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequest.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequest.java
@@ -457,7 +457,7 @@
    * @throws NullPointerException
    *           If {@code password} was {@code null}.
    */
-  GSSAPISASLBindRequest setPassword(String password)
+  GSSAPISASLBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException;
 
 
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequestImpl.java
index 86f3bd1..d139e2d 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/GSSAPISASLBindRequestImpl.java
@@ -699,7 +699,7 @@
    * {@inheritDoc}
    */
   @Override
-  public GSSAPISASLBindRequest setPassword(final String password)
+  public GSSAPISASLBindRequest setPassword(final char[] password)
       throws NullPointerException
   {
     Validator.ensureNotNull(password);
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequest.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequest.java
index 416b0d4..a08ac19 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequest.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequest.java
@@ -107,17 +107,6 @@
 
 
   /**
-   * Returns the desired password for the user decoded as a UTF-8 string, or
-   * {@code null} if a new password should be generated.
-   *
-   * @return The desired password for the user decoded as a UTF-8 string, or
-   *         {@code null} if a new password should be generated.
-   */
-  String getNewPasswordAsString();
-
-
-
-  /**
    * {@inheritDoc}
    */
   String getOID();
@@ -135,17 +124,6 @@
 
 
   /**
-   * Returns the current password for the user, if known, decoded as a UTF-8
-   * string.
-   *
-   * @return The current password for the user decoded as a UTF-8 string, or
-   *         {@code null} if the password is not known.
-   */
-  String getOldPasswordAsString();
-
-
-
-  /**
    * {@inheritDoc}
    */
   ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder();
@@ -222,7 +200,7 @@
    *           If this password modify extended request does not permit the new
    *           password to be set.
    */
-  PasswordModifyExtendedRequest setNewPassword(String newPassword)
+  PasswordModifyExtendedRequest setNewPassword(char[] newPassword)
       throws UnsupportedOperationException;
 
 
@@ -255,7 +233,7 @@
    *           If this password modify extended request does not permit the old
    *           password to be set.
    */
-  PasswordModifyExtendedRequest setOldPassword(String oldPassword)
+  PasswordModifyExtendedRequest setOldPassword(char[] oldPassword)
       throws UnsupportedOperationException;
 
 
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequestImpl.java
index ece2e20..add4b05 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/PasswordModifyExtendedRequestImpl.java
@@ -243,16 +243,6 @@
   /**
    * {@inheritDoc}
    */
-  public String getNewPasswordAsString()
-  {
-    return newPassword != null ? newPassword.toString() : null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
   @Override
   public String getOID()
   {
@@ -274,16 +264,6 @@
   /**
    * {@inheritDoc}
    */
-  public String getOldPasswordAsString()
-  {
-    return oldPassword != null ? oldPassword.toString() : null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
   @Override
   public ExtendedResultDecoder<PasswordModifyExtendedResult> getResultDecoder()
   {
@@ -375,7 +355,7 @@
   /**
    * {@inheritDoc}
    */
-  public PasswordModifyExtendedRequest setNewPassword(final String newPassword)
+  public PasswordModifyExtendedRequest setNewPassword(final char[] newPassword)
   {
     this.newPassword = (newPassword != null) ? ByteString.valueOf(newPassword)
         : null;
@@ -399,7 +379,7 @@
   /**
    * {@inheritDoc}
    */
-  public PasswordModifyExtendedRequest setOldPassword(final String oldPassword)
+  public PasswordModifyExtendedRequest setOldPassword(final char[] oldPassword)
   {
     this.oldPassword = (oldPassword != null) ? ByteString.valueOf(oldPassword)
         : null;
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequest.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequest.java
index fccb0e8..f49994c 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequest.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequest.java
@@ -224,6 +224,6 @@
    * @throws NullPointerException
    *           If {@code password} was {@code null}.
    */
-  PlainSASLBindRequest setPassword(String password)
+  PlainSASLBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException;
 }
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequestImpl.java
index 75fb011..f5ebe93 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/PlainSASLBindRequestImpl.java
@@ -242,7 +242,7 @@
   /**
    * {@inheritDoc}
    */
-  public PlainSASLBindRequest setPassword(final String password)
+  public PlainSASLBindRequest setPassword(final char[] password)
       throws NullPointerException
   {
     Validator.ensureNotNull(password);
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/Requests.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/Requests.java
index 9815d0b..47b2249 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/Requests.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/Requests.java
@@ -835,7 +835,7 @@
    *           If {@code name} or {@code password} was {@code null}.
    */
   public static SimpleBindRequest newSimpleBindRequest(final String name,
-      final String password) throws NullPointerException
+      final char[] password) throws NullPointerException
   {
     Validator.ensureNotNull(name, password);
     return new SimpleBindRequestImpl(name, ByteString.valueOf(password));
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequest.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequest.java
index 7109836..5316edf 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequest.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequest.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2009 Sun Microsystems, Inc.
+ *      Copyright 2009-2010 Sun Microsystems, Inc.
  */
 
 package org.opends.sdk.requests;
@@ -114,18 +114,6 @@
 
 
   /**
-   * Returns the password of the Directory object that the client wishes to bind
-   * as decoded as a UTF-8 string. The password may be empty (but never {@code
-   * null}) when used for of anonymous or unauthenticated binds.
-   *
-   * @return The password of the Directory object that the client wishes to bind
-   *         as decoded as a UTF-8 string.
-   */
-  String getPasswordAsString();
-
-
-
-  /**
    * Sets the name of the Directory object that the client wishes to bind as.
    * The name may be empty (but never {@code null} when used for of anonymous
    * binds, or when using SASL authentication. The server shall not dereference
@@ -174,7 +162,8 @@
    * Sets the password of the Directory object that the client wishes to bind
    * as. The password will be converted to a UTF-8 octet string. The password
    * may be empty (but never {@code null}) when used for of anonymous or
-   * unauthenticated binds.
+   * unauthenticated binds. Subsequent modifications to the {@code password}
+   * array will not alter this bind request.
    *
    * @param password
    *          The password of the Directory object that the client wishes to
@@ -186,7 +175,7 @@
    * @throws NullPointerException
    *           If {@code password} was {@code null}.
    */
-  SimpleBindRequest setPassword(String password)
+  SimpleBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException;
 
 }
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequestImpl.java
index 59c9655..dc24eb6 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/SimpleBindRequestImpl.java
@@ -131,16 +131,6 @@
   /**
    * {@inheritDoc}
    */
-  public String getPasswordAsString()
-  {
-    return password.toString();
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
   public SimpleBindRequest setName(final String name)
       throws UnsupportedOperationException, NullPointerException
   {
@@ -167,7 +157,7 @@
   /**
    * {@inheritDoc}
    */
-  public SimpleBindRequest setPassword(final String password)
+  public SimpleBindRequest setPassword(final char[] password)
       throws UnsupportedOperationException, NullPointerException
   {
     Validator.ensureNotNull(password);
@@ -188,7 +178,7 @@
     builder.append(getName());
     builder.append(", authentication=simple");
     builder.append(", password=");
-    builder.append(getPasswordAsString());
+    builder.append(getPassword());
     builder.append(", controls=");
     builder.append(getControls());
     builder.append(")");
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java
index 978ce1b..8f0d2da 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java
@@ -64,7 +64,7 @@
   }
 
   @Override
-  public CRAMMD5SASLBindRequest setPassword(String password)
+  public CRAMMD5SASLBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException {
     throw new UnsupportedOperationException();
   }
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java
index 0a0ce32..94aef03 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java
@@ -146,7 +146,7 @@
   }
 
   @Override
-  public DigestMD5SASLBindRequest setPassword(String password)
+  public DigestMD5SASLBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException {
     throw new UnsupportedOperationException();
   }
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableGSSAPISASLBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableGSSAPISASLBindRequestImpl.java
index 3f563f1..0f4a683 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableGSSAPISASLBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableGSSAPISASLBindRequestImpl.java
@@ -150,7 +150,7 @@
   }
 
   @Override
-  public GSSAPISASLBindRequest setPassword(String password)
+  public GSSAPISASLBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException {
     throw new UnsupportedOperationException();
   }
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java
index 1679ee5..44a61b8 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java
@@ -47,18 +47,10 @@
     return impl.getNewPassword();
   }
 
-  public String getNewPasswordAsString() {
-    return impl.getNewPasswordAsString();
-  }
-
   public ByteString getOldPassword() {
     return impl.getOldPassword();
   }
 
-  public String getOldPasswordAsString() {
-    return impl.getOldPasswordAsString();
-  }
-
   public ByteString getUserIdentity() {
     return impl.getUserIdentity();
   }
@@ -72,7 +64,7 @@
     throw new UnsupportedOperationException();
   }
 
-  public PasswordModifyExtendedRequest setNewPassword(String newPassword) {
+  public PasswordModifyExtendedRequest setNewPassword(char[] newPassword) {
     throw new UnsupportedOperationException();
   }
 
@@ -81,7 +73,7 @@
     throw new UnsupportedOperationException();
   }
 
-  public PasswordModifyExtendedRequest setOldPassword(String oldPassword) {
+  public PasswordModifyExtendedRequest setOldPassword(char[] oldPassword) {
     throw new UnsupportedOperationException();
   }
 
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePlainSASLBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePlainSASLBindRequestImpl.java
index a893b36d..79b03c4 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePlainSASLBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiablePlainSASLBindRequestImpl.java
@@ -76,7 +76,7 @@
   }
 
   @Override
-  public PlainSASLBindRequest setPassword(String password)
+  public PlainSASLBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException {
     throw new UnsupportedOperationException();
   }
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableSimpleBindRequestImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableSimpleBindRequestImpl.java
index c279ed2..0f143b6 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableSimpleBindRequestImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/requests/UnmodifiableSimpleBindRequestImpl.java
@@ -44,10 +44,6 @@
     return impl.getPassword();
   }
 
-  public String getPasswordAsString() {
-    return impl.getPasswordAsString();
-  }
-
   public SimpleBindRequest setName(String name)
       throws UnsupportedOperationException, NullPointerException {
     throw new UnsupportedOperationException();
@@ -58,7 +54,7 @@
     throw new UnsupportedOperationException();
   }
 
-  public SimpleBindRequest setPassword(String password)
+  public SimpleBindRequest setPassword(char[] password)
       throws UnsupportedOperationException, NullPointerException {
     throw new UnsupportedOperationException();
   }
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResult.java b/opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResult.java
index 3e33f7a..6f04319 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResult.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResult.java
@@ -109,19 +109,6 @@
 
 
   /**
-   * Returns the newly generated password decoded as a UTF-8 string, but only if
-   * the password modify request succeeded and a generated password was
-   * requested.
-   *
-   * @return The newly generated password decoded as a UTF-8 string, or {@code
-   *         null} if the password modify request failed or a generated password
-   *         was not requested.
-   */
-  String getGeneratedPasswordAsString();
-
-
-
-  /**
    * {@inheritDoc}
    */
   String getMatchedDN();
@@ -221,7 +208,7 @@
    *           If this password modify extended result does not permit the
    *           generated password to be set.
    */
-  PasswordModifyExtendedResult setGeneratedPassword(String password)
+  PasswordModifyExtendedResult setGeneratedPassword(char[] password)
       throws UnsupportedOperationException;
 
 
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResultImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResultImpl.java
index 4c50a01..a90d214 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResultImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/responses/PasswordModifyExtendedResultImpl.java
@@ -97,16 +97,6 @@
   /**
    * {@inheritDoc}
    */
-  public String getGeneratedPasswordAsString()
-  {
-    return password != null ? password.toString() : null;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
   @Override
   public String getOID()
   {
@@ -174,7 +164,7 @@
    * {@inheritDoc}
    */
   public PasswordModifyExtendedResult setGeneratedPassword(
-      final String password) throws UnsupportedOperationException
+      final char[] password) throws UnsupportedOperationException
   {
     this.password = (password != null) ? ByteString.valueOf(password) : null;
     return this;
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/responses/UnmodifiablePasswordModifyExtendedResultImpl.java b/opendj-sdk/sdk/src/org/opends/sdk/responses/UnmodifiablePasswordModifyExtendedResultImpl.java
index 4d0e675..58b1947 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/responses/UnmodifiablePasswordModifyExtendedResultImpl.java
+++ b/opendj-sdk/sdk/src/org/opends/sdk/responses/UnmodifiablePasswordModifyExtendedResultImpl.java
@@ -47,11 +47,6 @@
   }
 
   @Override
-  public String getGeneratedPasswordAsString() {
-    return impl.getGeneratedPasswordAsString();
-  }
-
-  @Override
   public PasswordModifyExtendedResult setGeneratedPassword(ByteString password)
       throws UnsupportedOperationException
   {
@@ -59,7 +54,7 @@
   }
 
   @Override
-  public PasswordModifyExtendedResult setGeneratedPassword(String password)
+  public PasswordModifyExtendedResult setGeneratedPassword(char[] password)
       throws UnsupportedOperationException {
     throw new UnsupportedOperationException();
   }
diff --git a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ByteStringTestCase.java b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ByteStringTestCase.java
index 6efde50..809937d 100644
--- a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ByteStringTestCase.java
+++ b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ByteStringTestCase.java
@@ -29,6 +29,8 @@
 
 
 
+import java.util.Arrays;
+
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -102,7 +104,7 @@
 
 
 
-  @DataProvider(name = "byteStringIntegerProvier")
+  @DataProvider(name = "byteStringIntegerProvider")
   public Object[][] byteStringIntegerProvider()
   {
     return new Object[][] { { ByteString.valueOf(0), 0 },
@@ -113,7 +115,7 @@
 
 
 
-  @DataProvider(name = "byteStringLongProvier")
+  @DataProvider(name = "byteStringLongProvider")
   public Object[][] byteStringLongProvider()
   {
     return new Object[][] { { ByteString.valueOf(0L), 0L },
@@ -124,6 +126,14 @@
 
 
 
+  @DataProvider(name = "byteStringCharArrayProvider")
+  public Object[][] byteStringCharArrayProvider()
+  {
+    return new Object[][] { { "" }, { "1" }, { "1234567890" } };
+  }
+
+
+
   @Test(expectedExceptions = IndexOutOfBoundsException.class)
   public void testInvalidWrapLength()
   {
@@ -149,6 +159,24 @@
 
 
 
+  @Test(dataProvider = "byteStringCharArrayProvider")
+  public void testToCharArray(final String s)
+  {
+    ByteString bs = ByteString.valueOf(s);
+    Assert.assertTrue(Arrays.equals(bs.toCharArray(), s.toCharArray()));
+  }
+
+
+
+  @Test(dataProvider = "byteStringCharArrayProvider")
+  public void testValueOfCharArray(final String s)
+  {
+    ByteString bs = ByteString.valueOf(s.toCharArray());
+    Assert.assertEquals(bs.toString(), s);
+  }
+
+
+
   @Test(expectedExceptions = IndexOutOfBoundsException.class)
   public void testUndersizedToInteger()
   {
diff --git a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ConnectionFactoryTestCase.java b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ConnectionFactoryTestCase.java
index e89e534..5c60a52 100644
--- a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ConnectionFactoryTestCase.java
+++ b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/ConnectionFactoryTestCase.java
@@ -149,7 +149,7 @@
     // AuthenticatedConnectionFactory
     factories[2][0] = new AuthenticatedConnectionFactory(
         new LDAPConnectionFactory("localhost", TestCaseUtils.getLdapPort()),
-        Requests.newSimpleBindRequest("", ""));
+        Requests.newSimpleBindRequest("", new char[0]));
 
     // AuthenticatedConnectionFactory with multi-stage SASL
     factories[3][0] = new AuthenticatedConnectionFactory(
diff --git a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/DNTestCase.java b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/DNTestCase.java
index 3e5d334..893ec98 100644
--- a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/DNTestCase.java
+++ b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/DNTestCase.java
@@ -37,8 +37,6 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import com.sun.opends.sdk.util.Platform;
-
 
 
 /**
diff --git a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/LDAPListenerTestCase.java b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/LDAPListenerTestCase.java
index 1cefb8b..34998fb 100644
--- a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/LDAPListenerTestCase.java
+++ b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/LDAPListenerTestCase.java
@@ -748,7 +748,7 @@
             proxyListener.getSocketAddress()).getConnection();
         try
         {
-          connection.bind("cn=test", "password");
+          connection.bind("cn=test", "password".toCharArray());
 
           Assert.assertTrue(proxyServerConnection.isConnected.await(10,
               TimeUnit.SECONDS));
@@ -961,7 +961,7 @@
             proxyListener.getSocketAddress()).getConnection();
         try
         {
-          connection.bind("cn=test", "password");
+          connection.bind("cn=test", "password".toCharArray());
 
           Assert.assertTrue(proxyServerConnection.isConnected.await(10,
               TimeUnit.SECONDS));
@@ -1012,7 +1012,7 @@
           onlineServerListener.getSocketAddress()).getConnection();
       try
       {
-        connection.bind("cn=test", "password");
+        connection.bind("cn=test", "password".toCharArray());
       }
       catch (final ErrorResultException e)
       {
@@ -1043,7 +1043,7 @@
 
     try
     {
-      connection.bind("cn=test", "password");
+      connection.bind("cn=test", "password".toCharArray());
       Assert.fail("Bind attempt on closed connection succeeded unexpectedly");
     }
     catch (final ErrorResultException e)
diff --git a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/RDNTestCase.java b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/RDNTestCase.java
index f889e46..c116b69 100644
--- a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/RDNTestCase.java
+++ b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/RDNTestCase.java
@@ -42,8 +42,6 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
-import com.sun.opends.sdk.util.Platform;
-
 
 
 /**
diff --git a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/requests/SimpleBindRequestTestCase.java b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/requests/SimpleBindRequestTestCase.java
index 3086718..bd3bdc3 100644
--- a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/requests/SimpleBindRequestTestCase.java
+++ b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/requests/SimpleBindRequestTestCase.java
@@ -42,7 +42,7 @@
   public Object[][] getSimpleBindRequests() throws Exception
   {
     final SimpleBindRequest[] requests = { Requests.newSimpleBindRequest(),// anonymous;
-        Requests.newSimpleBindRequest("username", "password") };
+        Requests.newSimpleBindRequest("username", "password".toCharArray()) };
     final Object[][] objArray = new Object[requests.length][1];
     for (int i = 0; i < requests.length; i++)
     {
diff --git a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleTest.java b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleTest.java
index d2054d4..e2717fc 100644
--- a/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleTest.java
+++ b/opendj-sdk/sdk/tests/unit-tests-testng/src/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleTest.java
@@ -27,13 +27,15 @@
 
 package org.opends.sdk.schema;
 
+import java.text.Normalizer;
+import java.text.Normalizer.Form;
+
 import org.testng.annotations.Test;
 import org.testng.annotations.DataProvider;
 import static org.testng.Assert.assertEquals;
 import org.opends.sdk.ConditionResult;
 import org.opends.sdk.ByteString;
 import static org.opends.sdk.schema.SchemaConstants.EMR_DN_OID;
-import com.sun.opends.sdk.util.Platform;
 
 /**
  * Test the DistinguishedNameEqualityMatchingRule
@@ -204,9 +206,8 @@
 
     final ByteString normalizedValue1 = rule.normalizeAttributeValue(ByteString
         .valueOf(value1));
-    StringBuilder buffer = new StringBuilder(value2);
-    Platform.normalize(buffer);
-    final ByteString expectedValue = ByteString.valueOf(buffer);
+    final ByteString expectedValue = ByteString.valueOf(Normalizer.normalize(
+        value2, Form.NFKD));
     assertEquals(normalizedValue1, expectedValue);
   }
 }

--
Gitblit v1.10.0