public void encode(DerOutputStream out) throws IOException {
  if (extensionId == null)   throw new IOException("Null OID to encode for the extension!");
  if (extensionValue == null)   throw new IOException("No value to encode for the extension!");
  DerOutputStream dos=new DerOutputStream();
  dos.putOID(extensionId);
  if (critical)   dos.putBoolean(critical);
  dos.putOctetString(extensionValue);
  out.write(DerValue.tag_Sequence,dos);
}

public void encode ( DerOutputStream out ) throws IOException { if ( extensionId == null ) throw new IOException ( "Null OID to encode for the extension!" ) ; if ( extensionValue == null ) throw new IOException ( "No value to encode for the extension!" ) ; DerOutputStream dos = new DerOutputStream ( ) ; dos . putOID ( extensionId ) ; if ( critical ) dos . putBoolean ( critical ) ; dos . putOctetString ( extensionValue ) ; out . write ( DerValue . tag_Sequence , dos ) ; }
write the extension to the deroutputstream .
