Exemplo n.º 1
0
  public void encode(OutputStream out) throws IOException {
    if (out == null) {
      throw new NullPointerException();
    }

    DerOutputStream dos1 = new DerOutputStream();
    DerOutputStream dos2 = new DerOutputStream();

    dos1.putOID(extensionId);
    if (critical) {
      dos1.putBoolean(critical);
    }
    dos1.putOctetString(extensionValue);

    dos2.write(DerValue.tag_Sequence, dos1);
    out.write(dos2.toByteArray());
  }
Exemplo n.º 2
0
  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);
  }