From 22094368c2865dcfb6daf8366425212b721a4657 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 05 Feb 2009 17:42:14 +0000
Subject: [PATCH] Merge ASN1 branch to trunk

---
 opends/src/server/org/opends/server/extensions/Base64PasswordStorageScheme.java |   36 +++++++++++++++---------------------
 1 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/opends/src/server/org/opends/server/extensions/Base64PasswordStorageScheme.java b/opends/src/server/org/opends/server/extensions/Base64PasswordStorageScheme.java
index b14740c..c7825da 100644
--- a/opends/src/server/org/opends/server/extensions/Base64PasswordStorageScheme.java
+++ b/opends/src/server/org/opends/server/extensions/Base64PasswordStorageScheme.java
@@ -33,12 +33,7 @@
 import org.opends.server.api.PasswordStorageScheme;
 import org.opends.server.config.ConfigException;
 import org.opends.server.loggers.debug.DebugTracer;
-import org.opends.server.types.ByteString;
-import org.opends.server.types.ByteStringFactory;
-import org.opends.server.types.DebugLogLevel;
-import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
-import org.opends.server.types.ResultCode;
+import org.opends.server.types.*;
 import org.opends.server.util.Base64;
 
 import static org.opends.messages.ExtensionMessages.*;
@@ -103,10 +98,10 @@
    * {@inheritDoc}
    */
   @Override()
-  public ByteString encodePassword(ByteString plaintext)
+  public ByteString encodePassword(ByteSequence plaintext)
          throws DirectoryException
   {
-    return ByteStringFactory.create(Base64.encode(plaintext.value()));
+    return ByteString.valueOf(Base64.encode(plaintext));
   }
 
 
@@ -115,16 +110,16 @@
    * {@inheritDoc}
    */
   @Override()
-  public ByteString encodePasswordWithScheme(ByteString plaintext)
+  public ByteString encodePasswordWithScheme(ByteSequence plaintext)
          throws DirectoryException
   {
     StringBuilder buffer = new StringBuilder();
     buffer.append('{');
     buffer.append(STORAGE_SCHEME_NAME_BASE64);
     buffer.append('}');
-    buffer.append(Base64.encode(plaintext.value()));
+    buffer.append(Base64.encode(plaintext));
 
-    return ByteStringFactory.create(buffer.toString());
+    return ByteString.valueOf(buffer.toString());
   }
 
 
@@ -133,11 +128,11 @@
    * {@inheritDoc}
    */
   @Override()
-  public boolean passwordMatches(ByteString plaintextPassword,
-                                 ByteString storedPassword)
+  public boolean passwordMatches(ByteSequence plaintextPassword,
+                                 ByteSequence storedPassword)
   {
-    String userString   = Base64.encode(plaintextPassword.value());
-    String storedString = storedPassword.stringValue();
+    String userString   = Base64.encode(plaintextPassword);
+    String storedString = storedPassword.toString();
     return userString.equals(storedString);
   }
 
@@ -158,13 +153,12 @@
    * {@inheritDoc}
    */
   @Override()
-  public ByteString getPlaintextValue(ByteString storedPassword)
+  public ByteString getPlaintextValue(ByteSequence storedPassword)
          throws DirectoryException
   {
     try
     {
-      return ByteStringFactory.create(Base64.decode(
-                                           storedPassword.stringValue()));
+      return ByteString.wrap(Base64.decode(storedPassword.toString()));
     }
     catch (Exception e)
     {
@@ -174,7 +168,7 @@
       }
 
       Message message = ERR_PWSCHEME_CANNOT_BASE64_DECODE_STORED_PASSWORD.get(
-          storedPassword.stringValue(), String.valueOf(e));
+          storedPassword.toString(), String.valueOf(e));
       throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message,
                                    e);
     }
@@ -198,7 +192,7 @@
    * {@inheritDoc}
    */
   @Override()
-  public ByteString encodeAuthPassword(ByteString plaintext)
+  public ByteString encodeAuthPassword(ByteSequence plaintext)
          throws DirectoryException
   {
     Message message =
@@ -212,7 +206,7 @@
    * {@inheritDoc}
    */
   @Override()
-  public boolean authPasswordMatches(ByteString plaintextPassword,
+  public boolean authPasswordMatches(ByteSequence plaintextPassword,
                                      String authInfo, String authValue)
   {
     // This storage scheme does not support the authentication password syntax.

--
Gitblit v1.10.0