You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/09/04 03:22:22 UTC
svn commit: r267535 - in
/directory/asn1/trunk/der/src/java/org/apache/asn1/der:
ASN1InputStream.java DERTaggedObject.java
Author: erodriguez
Date: Sat Sep 3 18:22:13 2005
New Revision: 267535
URL: http://svn.apache.org/viewcvs?rev=267535&view=rev
Log:
Updates to asn1-der to support checksum verification
o Addition of undecoded byte[] to tagged objects
o Setting of undecoded byte[] in asn1 input stream
Modified:
directory/asn1/trunk/der/src/java/org/apache/asn1/der/ASN1InputStream.java
directory/asn1/trunk/der/src/java/org/apache/asn1/der/DERTaggedObject.java
Modified: directory/asn1/trunk/der/src/java/org/apache/asn1/der/ASN1InputStream.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/der/src/java/org/apache/asn1/der/ASN1InputStream.java?rev=267535&r1=267534&r2=267535&view=diff
==============================================================================
--- directory/asn1/trunk/der/src/java/org/apache/asn1/der/ASN1InputStream.java (original)
+++ directory/asn1/trunk/der/src/java/org/apache/asn1/der/ASN1InputStream.java Sat Sep 3 18:22:13 2005
@@ -282,7 +282,7 @@
// Explicitly tagged - if it isn't we'd have to tell from the context.
if ( ais.available() == 0 )
{
- return new DERTaggedObject( tagNo, encodable );
+ return new DERTaggedObject( true, tagNo, encodable, bytes );
}
// Another implicit object, create a sequence.
Modified: directory/asn1/trunk/der/src/java/org/apache/asn1/der/DERTaggedObject.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/der/src/java/org/apache/asn1/der/DERTaggedObject.java?rev=267535&r1=267534&r2=267535&view=diff
==============================================================================
--- directory/asn1/trunk/der/src/java/org/apache/asn1/der/DERTaggedObject.java (original)
+++ directory/asn1/trunk/der/src/java/org/apache/asn1/der/DERTaggedObject.java Sat Sep 3 18:22:13 2005
@@ -26,10 +26,20 @@
public class DERTaggedObject implements DEREncodable
{
protected int tag;
- protected boolean empty = false;
+ protected boolean empty = false;
protected boolean explicit = true;
- protected DEREncodable obj = null;
-
+ protected DEREncodable obj;
+ private byte[] bytes;
+
+ /**
+ * create an implicitly tagged object that contains a zero
+ * length sequence.
+ */
+ public DERTaggedObject( int tag )
+ {
+ this( false, tag, new DERSequence() );
+ }
+
/**
* @param tag the tag number for this object.
* @param obj the tagged object.
@@ -43,7 +53,7 @@
/**
* @param explicit true if an explicitly tagged object.
- * @param tagNo the tag number for this object.
+ * @param tag the tag number for this object.
* @param obj the tagged object.
*/
public DERTaggedObject( boolean explicit, int tag, DEREncodable obj )
@@ -52,21 +62,25 @@
this.tag = tag;
this.obj = obj;
}
-
- /**
- * create an implicitly tagged object that contains a zero
- * length sequence.
- */
- public DERTaggedObject( int tag )
+
+ public DERTaggedObject( boolean explicit, int tag, DEREncodable obj, byte[] bytes )
{
- this( false, tag, new DERSequence() );
+ this.explicit = explicit;
+ this.tag = tag;
+ this.obj = obj;
+ this.bytes = bytes;
}
-
+
+ public byte[] getOctets()
+ {
+ return bytes;
+ }
+
public int getTagNo()
{
return tag;
}
-
+
/**
* return whatever was following the tag.
* <p>
@@ -84,8 +98,7 @@
return null;
}
- public void encode( ASN1OutputStream out )
- throws IOException
+ public void encode( ASN1OutputStream out ) throws IOException
{
if ( !empty )
{
@@ -106,11 +119,11 @@
// need to mark constructed types
if ( ( bytes[ 0 ] & DERObject.CONSTRUCTED ) != 0 )
{
- bytes[ 0 ] = (byte)( DERObject.CONSTRUCTED | DERObject.TAGGED | tag );
+ bytes[ 0 ] = (byte) ( DERObject.CONSTRUCTED | DERObject.TAGGED | tag );
}
else
{
- bytes[ 0 ] = (byte)( DERObject.TAGGED | tag );
+ bytes[ 0 ] = (byte) ( DERObject.TAGGED | tag );
}
out.write( bytes );
@@ -122,4 +135,3 @@
}
}
}
-