public ObjectIdentifier(String oid) throws IOException {
  int ch='.';
  int start=0;
  int end=0;
  int pos=0;
  byte[] tmp=new byte[oid.length()];
  int first=0, second;
  int count=0;
  try {
    String comp=null;
    do {
      int length=0;
      end=oid.indexOf(ch,start);
      if (end == -1) {
        comp=oid.substring(start);
        length=oid.length() - start;
      }
 else {
        comp=oid.substring(start,end);
        length=end - start;
      }
      if (length > 9) {
        BigInteger bignum=new BigInteger(comp);
        if (count == 0) {
          checkFirstComponent(bignum);
          first=bignum.intValue();
        }
 else {
          if (count == 1) {
            checkSecondComponent(first,bignum);
            bignum=bignum.add(BigInteger.valueOf(40 * first));
          }
 else {
            checkOtherComponent(count,bignum);
          }
          pos+=pack7Oid(bignum,tmp,pos);
        }
      }
 else {
        int num=Integer.parseInt(comp);
        if (count == 0) {
          checkFirstComponent(num);
          first=num;
        }
 else {
          if (count == 1) {
            checkSecondComponent(first,num);
            num+=40 * first;
          }
 else {
            checkOtherComponent(count,num);
          }
          pos+=pack7Oid(num,tmp,pos);
        }
      }
      start=end + 1;
      count++;
    }
 while (end != -1);
    checkCount(count);
    encoding=new byte[pos];
    System.arraycopy(tmp,0,encoding,0,pos);
    this.stringForm=oid;
  }
 catch (  IOException ioe) {
    throw ioe;
  }
catch (  Exception e) {
    throw new IOException("ObjectIdentifier() -- Invalid format: " + e.toString(),e);
  }
}

public ObjectIdentifier ( String oid ) throws IOException { int ch = '.' ; int start = 0 ; int end = 0 ; int pos = 0 ; byte [ ] tmp = new byte [ oid . length ( ) ] ; int first = 0 , second ; int count = 0 ; try { String comp = null ; do { int length = 0 ; end = oid . indexOf ( ch , start ) ; if ( end == - 1 ) { comp = oid . substring ( start ) ; length = oid . length ( ) - start ; } else { comp = oid . substring ( start , end ) ; length = end - start ; } if ( length > 9 ) { BigInteger bignum = new BigInteger ( comp ) ; if ( count == 0 ) { checkFirstComponent ( bignum ) ; first = bignum . intValue ( ) ; } else { if ( count == 1 ) { checkSecondComponent ( first , bignum ) ; bignum = bignum . add ( BigInteger . valueOf ( 40 * first ) ) ; } else { checkOtherComponent ( count , bignum ) ; } pos += pack7Oid ( bignum , tmp , pos ) ; } } else { int num = Integer . parseInt ( comp ) ; if ( count == 0 ) { checkFirstComponent ( num ) ; first = num ; } else { if ( count == 1 ) { checkSecondComponent ( first , num ) ; num += 40 * first ; } else { checkOtherComponent ( count , num ) ; } pos += pack7Oid ( num , tmp , pos ) ; } } start = end + 1 ; count ++ ; } while ( end != - 1 ) ; checkCount ( count ) ; encoding = new byte [ pos ] ; System . arraycopy ( tmp , 0 , encoding , 0 , pos ) ; this . stringForm = oid ; } catch ( IOException ioe ) { throw ioe ; } catch ( Exception e ) { throw new IOException ( "ObjectIdentifier() -- Invalid format: " + e . toString ( ) , e ) ; } }
constructs , from a string . this string should be of the form 1 . 23 . 56 . validity check included .
