code: 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);
      }
docs: Write the extension to the DerOutputStream.
  
  @param out the DerOutputStream to write the extension to.
  @exception IOException on encoding errors