public byte[] asn1Encode() throws Asn1Exception, IOException {
  DerOutputStream bytes=new DerOutputStream();
  DerOutputStream temp=new DerOutputStream();
  temp.putInteger(etype);
  bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,true,TAG_TYPE),temp);
  if (salt != null) {
    temp=new DerOutputStream();
    if (KerberosString.MSNAME) {
      temp.putOctetString(salt.getBytes("UTF8"));
    }
 else {
      temp.putOctetString(salt.getBytes());
    }
    bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT,true,TAG_VALUE),temp);
  }
  temp=new DerOutputStream();
  temp.write(DerValue.tag_Sequence,bytes);
  return temp.toByteArray();
}

public byte [ ] asn1Encode ( ) throws Asn1Exception , IOException { DerOutputStream bytes = new DerOutputStream ( ) ; DerOutputStream temp = new DerOutputStream ( ) ; temp . putInteger ( etype ) ; bytes . write ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , TAG_TYPE ) , temp ) ; if ( salt != null ) { temp = new DerOutputStream ( ) ; if ( KerberosString . MSNAME ) { temp . putOctetString ( salt . getBytes ( "UTF8" ) ) ; } else { temp . putOctetString ( salt . getBytes ( ) ) ; } bytes . write ( DerValue . createTag ( DerValue . TAG_CONTEXT , true , TAG_VALUE ) , temp ) ; } temp = new DerOutputStream ( ) ; temp . write ( DerValue . tag_Sequence , bytes ) ; return temp . toByteArray ( ) ; }
encodes this object to an outputstream .
