/** * 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); }