directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r125329 - /incubator/directory/changepw/trunk/core/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java
Date Sun, 16 Jan 2005 01:26:07 GMT
Author: erodriguez
Date: Sat Jan 15 17:26:05 2005
New Revision: 125329

URL: http://svn.apache.org/viewcvs?view=rev&rev=125329
Log:
Redirecting Changepw ASN.1 DER decoding to use Apache libraries.
Modified:
   incubator/directory/changepw/trunk/core/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java

Modified: incubator/directory/changepw/trunk/core/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/changepw/trunk/core/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java?view=diff&rev=125329&p1=incubator/directory/changepw/trunk/core/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java&r1=125328&p2=incubator/directory/changepw/trunk/core/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java&r2=125329
==============================================================================
--- incubator/directory/changepw/trunk/core/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java
(original)
+++ incubator/directory/changepw/trunk/core/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java
Sat Jan 15 17:26:05 2005
@@ -14,54 +14,59 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.changepw.io;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.util.Enumeration;
 
+import org.apache.asn1.der.ASN1InputStream;
+import org.apache.asn1.der.DERGeneralString;
+import org.apache.asn1.der.DERObject;
+import org.apache.asn1.der.DEROctetString;
+import org.apache.asn1.der.DERSequence;
+import org.apache.asn1.der.DERTaggedObject;
 import org.apache.changepw.value.ChangePasswordData;
 import org.apache.changepw.value.ChangePasswordDataModifier;
 import org.apache.kerberos.io.decoder.KerberosMessageDecoder;
-import org.bouncycastle.asn1.ASN1InputStream;
-import org.bouncycastle.asn1.DERGeneralString;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
 
-public class ChangePasswordDataDecoder extends KerberosMessageDecoder {
-	
-	public ChangePasswordData decodeChangePasswordData(byte[] encodedChangePasswdData) throws
IOException {
-		
-		ByteArrayInputStream bais = new ByteArrayInputStream(encodedChangePasswdData);
-		ASN1InputStream ais = new ASN1InputStream(bais);
+
+public class ChangePasswordDataDecoder extends KerberosMessageDecoder
+{
+	public ChangePasswordData decodeChangePasswordData( byte[] encodedChangePasswdData )
+		throws IOException
+	{
+		ByteArrayInputStream bais = new ByteArrayInputStream( encodedChangePasswdData );
+		ASN1InputStream ais = new ASN1InputStream( bais );
 		
 		DERSequence sequence = (DERSequence) ais.readObject();
 		
-		return decodeChangePasswdData(sequence);
+		return decodeChangePasswdData( sequence );
 	}
 	
-	protected ChangePasswordData decodeChangePasswdData(DERSequence sequence) {
-		
+	protected ChangePasswordData decodeChangePasswdData( DERSequence sequence )
+	{
 		ChangePasswordDataModifier modifier = new ChangePasswordDataModifier();
 
-		for (Enumeration e = sequence.getObjects(); e.hasMoreElements();) {
-			DERTaggedObject object = ((DERTaggedObject) e.nextElement());
+		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+		{
+			DERTaggedObject object = ( (DERTaggedObject) e.nextElement() );
 			int tag = object.getTagNo();
 			DERObject derObject = object.getObject();
-			switch (tag) {
+			switch ( tag )
+			{
 				case 0:
 					DEROctetString tag0 = (DEROctetString) derObject;
-					modifier.setNewPassword(tag0.getOctets());
+					modifier.setNewPassword( tag0.getOctets() );
 					break;
 				case 1:
 					DERSequence tag1 = (DERSequence) derObject;
-					modifier.setTargetName(decodePrincipalName(tag1));
+					modifier.setTargetName( decodePrincipalName( tag1 ) );
 					break;
 				case 2:
 					DERGeneralString tag2 = (DERGeneralString) derObject;
-					modifier.setTargetRealm(tag2.getString());
+					modifier.setTargetRealm( tag2.getString() );
 					break;
 				default:
 					break;

Mime
View raw message