Skip navigation links

Oracle Security Developer Tools Crypto FIPS Java API Reference
11g (11.1.1)

E10696-02


oracle.security.crypto.asn1
Class ASN1Header

java.lang.Object
  extended by oracle.security.crypto.asn1.ASN1Header

All Implemented Interfaces:
ASN1, Streamable

public class ASN1Header
extends java.lang.Object
implements Streamable, ASN1

Represents the header (tag, encoding method, and length) of an ASN.1 object encoding.


Field Summary

 

Fields inherited from interface oracle.security.crypto.asn1.ASN1
APPLICATION, BIT_STRING, BMP_STRING, BOOLEAN, CONSTRUCTED, CONSTRUCTED_DEFINITE, CONSTRUCTED_INDEFINITE, CONTEXT_SPECIFIC, END_OF_CONTENTS, ENUMERATED, EXTERNAL, GENERAL_STRING, GENERALIZED_TIME, GRAPHIC_STRING, IA5STRING, INTEGER, ISO646_STRING, NULL, NUMERIC_STRING, OBJECT_DESCRIPTOR, OBJECT_IDENTIFIER, OCTET_STRING, PRIMITIVE, PRINTABLE_STRING, PRIVATE, REAL, SEQUENCE, SET, T61STRING, TAG, TAG_CLASS, TELETEX_STRING, UNIVERSAL, UNIVERSAL_STRING, UTCTIME, UTF8_STRING, VIDEOTEX_STRING, VISIBLE_STRING

 

Constructor Summary
ASN1Header()
          Creates an uninitialized ASN.1 header.
ASN1Header(java.io.InputStream is)
           
ASN1Header(int t, int c)
          Creates an ASN1 Header of the specified tag and tag class.
ASN1Header(int t, int c, int m, int l)
          Creates an ASN1 Header of the specified tag, tag class, encoding method, and length.

 

Method Summary
 void checkEncodingMethod(int encodingMethod)
           
 void checkTag(int tag)
           
 void checkTagClass(int tagClass)
           
 java.lang.String encodingMethodToString(int encodingMethod)
           
 int getBodyLength()
          Returns the length of the body of this ASN.1 object.
 int getEncodingMethod()
           
 int getTag()
           
 int getTagClass()
           
 byte[] headerAndBody(java.io.InputStream is)
           
 void input(java.io.InputStream is)
          Reads this header from the specified input stream.
 int length()
          Returns the length of the DER encoding of this ASN.1 header.
 void output(java.io.OutputStream os)
          Writes this header to the specified output stream.
 byte[] readBody(java.io.InputStream is)
          Reads in the body from the specified input stream and returns it as a byte array.
 void skipBody(java.io.InputStream is)
           
 java.lang.String tagClassToString(int tagClass)
           
 java.lang.String tagToString(int tag)
           
 java.lang.String toString()
           
 int totalLength()
          Returns the total length of the ASN.1 object corresponding to this header.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

ASN1Header

public ASN1Header()
Creates an uninitialized ASN.1 header.

ASN1Header

public ASN1Header(int t,
                  int c)
Creates an ASN1 Header of the specified tag and tag class. The encoding method is Constructed/Indefinite-length.
Parameters:
t - The universal-class tag for this type (e.g., ASN1.IA5STRING)
c - The tag class (e.g., ASN1.UNIVERSAL).

ASN1Header

public ASN1Header(int t,
                  int c,
                  int m,
                  int l)
Creates an ASN1 Header of the specified tag, tag class, encoding method, and length.
Parameters:
t - The universal-class tag for this type (e.g., ASN1.IA5STRING)
c - The tag class (e.g., ASN1.UNIVERSAL).
m - The encoding method.
l - The body length.

ASN1Header

public ASN1Header(java.io.InputStream is)
           throws java.io.IOException
Throws:
java.io.IOException

Method Detail

getTag

public int getTag()

getTagClass

public int getTagClass()

getEncodingMethod

public int getEncodingMethod()

getBodyLength

public int getBodyLength()
Returns the length of the body of this ASN.1 object. This is only meaningful for primitive and constructed, definite-length encodings; in the constructed, indefinite-length case, -1 is returned.

length

public int length()
Returns the length of the DER encoding of this ASN.1 header.
Specified by:
length in interface Streamable

totalLength

public int totalLength()
Returns the total length of the ASN.1 object corresponding to this header. That is, the length of this header plus the body length of the object it describes.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

tagClassToString

public java.lang.String tagClassToString(int tagClass)

tagToString

public java.lang.String tagToString(int tag)

encodingMethodToString

public java.lang.String encodingMethodToString(int encodingMethod)

checkTagClass

public void checkTagClass(int tagClass)
                   throws ASN1FormatException
Throws:
ASN1FormatException

checkTag

public void checkTag(int tag)
              throws ASN1FormatException
Throws:
ASN1FormatException

checkEncodingMethod

public void checkEncodingMethod(int encodingMethod)
                         throws ASN1FormatException
Throws:
ASN1FormatException

output

public void output(java.io.OutputStream os)
            throws java.io.IOException
Writes this header to the specified output stream.
Specified by:
output in interface Streamable
Throws:
java.io.IOException

input

public void input(java.io.InputStream is)
           throws java.io.IOException
Reads this header from the specified input stream.
Specified by:
input in interface Streamable
Throws:
java.io.IOException

skipBody

public void skipBody(java.io.InputStream is)
              throws java.io.IOException
Throws:
java.io.IOException

readBody

public byte[] readBody(java.io.InputStream is)
                throws java.io.IOException
Reads in the body from the specified input stream and returns it as a byte array.
Throws:
java.io.IOException

headerAndBody

public byte[] headerAndBody(java.io.InputStream is)
                     throws java.io.IOException
Throws:
java.io.IOException

Skip navigation links

Oracle Security Developer Tools Crypto FIPS Java API Reference
11g (11.1.1)

E10696-02


Copyright © 2005, 2009, Oracle. All rights reserved.