directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: rev 56514 - incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/encoder
Date Wed, 03 Nov 2004 19:22:06 GMT
Author: erodriguez
Date: Wed Nov  3 11:22:05 2004
New Revision: 56514

Modified:
   incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java
Log:
Added convenience method to retrieve error message bytes, for use as payload in change password
error message.

Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java
(original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java
Wed Nov  3 11:22:05 2004
@@ -35,6 +35,19 @@
 		return aos;
 	}
 	
+	public byte[] encode(ErrorMessage message) throws IOException {
+		
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		ASN1OutputStream aos = new ASN1OutputStream(baos);
+		
+		DERSequence errorReply = encodeErrorMessageSequence(message);
+		aos.writeObject(new DERApplicationSpecific(message.getMessageType().getOrdinal(), errorReply));
+		
+		aos.close();
+		
+		return baos.toByteArray();
+	}
+	
 	private DERSequence encodeErrorMessageSequence(ErrorMessage message) {
 		
 		ASN1EncodableVector vector = new ASN1EncodableVector();

Mime
View raw message