/**
   * Encode the object
   *
   * @param buf
   * @throws IOException
   */
  public void derEncode(DERBuffer buf) throws IOException {

    // Pack the type, length and bytes

    buf.packByte(DER.GeneralizedTime);

    if (m_string != null) {
      byte[] byts = m_string.getBytes();
      buf.packLength(byts.length);
      buf.packBytes(byts, 0, byts.length);
    } else buf.packLength(0);
  }
  /**
   * DER encode the object
   *
   * @param buf DERBuffer
   */
  public void derEncode(DERBuffer buf) throws IOException {

    // Pack the type, length and bytes

    int tagNo = 0;
    if (isTagged()) tagNo = getTagNo();

    buf.packByte(DER.Application + DER.Constructed + (tagNo & 0xFF));

    if (m_bytes != null) {
      buf.packLength(m_bytes.length);
      buf.packBytes(m_bytes, 0, m_bytes.length);
    } else buf.packLength(0);
  }
  /**
   * DER decode the object
   *
   * @param buf DERBuffer
   */
  public void derDecode(DERBuffer buf) throws IOException {

    // Decode the type

    if ((buf.unpackType() & DER.Application) != 0) {

      // Unpack the length and bytes

      int len = buf.unpackLength();
      if (len > 0) {

        // Get the string bytes

        m_bytes = buf.unpackBytes(len);
      } else m_bytes = null;
    } else throw new IOException("Wrong DER type, expected ApplicationSpecific");
  }
  /**
   * Decode the object
   *
   * @param buf
   * @throws IOException
   */
  public void derDecode(DERBuffer buf) throws IOException {

    // Decode the type

    if (buf.unpackType() == DER.GeneralizedTime) {

      // Unpack the length and bytes

      int len = buf.unpackLength();
      if (len > 0) {

        // Get the string bytes

        byte[] byts = buf.unpackBytes(len);
        m_string = new String(byts);
      } else m_string = null;
    } else throw new IOException("Wrong DER type, expected GeneralString");
  }