com.novell.emframe.dev
Class ASNOne

java.lang.Object
  extended bycom.novell.emframe.dev.ASNOne

public class ASNOne
extends java.lang.Object

This class provides methods to convert a given LDAP OID string to a standard ASN1 ID sequence of bytes. An LDAP OID string is in the dotted decimal string format. For example, 1.2.840.

The following rules are applied to the LDAP string:

BER encoding. Primitive contents octets are as follows, where value1, ..., valueN denote the integer values of the components in the complete object identifier:

  1. The first octet has the value (40 x value1) + value2. (This is unambiguous, since value1 is limited to values 0, 1 and 2; value2 is limited to the range 0 to 39 when value1 is 0 or 1; and, according to X.208, N is always at least 2.)
  2. The following octets, if any, encode value3, ..., valueN. Each value is encoded base 128, most significant digit first, with as few digits as possible, and the most significant bit of each octet except the last in the value's encoding set to "1".

(From "A Layman's Guide to a Subst of ASN.1, BER, and DER" by Burton S. Kaliski Jr., Revised November 1, 1993.)

Example: The ASN.1 encoding for the LDAP OID string "1.2.840.113549" is 06 06 2A 86 48 86 F7 0D. 06 06 represents the length of the data following this byte. The first 06 in the 06 06 sequence is a special byte signifying that this data represents an OID.

The schema OIDs for the DNIP schema extensions are:

The LDAP OID for the "DNIP:Subnet Attr" attribute is represented as:

2.16.840.1.113719.1.25.4.1.1

The 1.1 at the end is the sequence number, which should be incremented for each new attribute type. The first 1 in the ending 1.1 sequence is the revision number of the attribute type (generally this is always 1).

The following table lists the currently-assigned OID to the various DNS/DHCP attribute types and object classes:

Attribute Type/Object Class OID
DNS/DHCP Attribute Types/DNIP:Subnet Attr 2.16.840.1.113719.1.25.4.1.1


Constructor Summary
ASNOne(byte[] oidArray)
          Constructor using a ASN1 ID byte array.
ASNOne(java.lang.String ldapString)
          Constructor using a ldap string representing an LDAP OID.
 
Method Summary
protected  java.lang.Byte firstOctetEncoder(java.lang.String firstComp, java.lang.String secondComp)
          Encodes two components of the LDAP OID String into a Byte object.
 byte[] getAsn1()
          Returns the ASN1 ID sequence of bytes.
 byte[] getNullAsn1()
          Returns an empty byte array sized to 32 bytes.
 java.lang.String getOid()
          Returns the LDAP OID String value.
 byte[] parseLDAPComponent(java.lang.String ldapComponent)
          Converts the given ldapComponent into a sequence of encoded bytes.
 java.lang.String toString()
          Return the LDAP OID string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASNOne

public ASNOne(byte[] oidArray)
Constructor using a ASN1 ID byte array.

Parameters:
oidArray - byte array containing an ASN1 ID sequence of bytes

ASNOne

public ASNOne(java.lang.String ldapString)
Constructor using a ldap string representing an LDAP OID.

Parameters:
ldapString - String containing and LDAP OID.
Method Detail

firstOctetEncoder

protected java.lang.Byte firstOctetEncoder(java.lang.String firstComp,
                                           java.lang.String secondComp)
Encodes two components of the LDAP OID String into a Byte object.

Parameters:
firstComp - The first component to encode
secondComp - The second component to encode
Returns:
Byte containing the encoded value of firstComp and secondComp

getAsn1

public byte[] getAsn1()
Returns the ASN1 ID sequence of bytes.

Returns:
byte array containing the ASN1 ID

getNullAsn1

public byte[] getNullAsn1()
Returns an empty byte array sized to 32 bytes.

Returns:
byte array that is empty

getOid

public java.lang.String getOid()
Returns the LDAP OID String value.

Returns:
String containing the LDAP OID value

parseLDAPComponent

public byte[] parseLDAPComponent(java.lang.String ldapComponent)
Converts the given ldapComponent into a sequence of encoded bytes.

Parameters:
ldapComponent - String containing the LDAP OID
Returns:
byte array containing the ASN1 ID

toString

public java.lang.String toString()
Return the LDAP OID string.

Returns:
String containing the LDAP OID


API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.