int encodedLength() throws IOException {
   if (encoded != null) {
     return 1 + StreamUtil.calculateBodyLength(encoded.length) + encoded.length;
   } else {
     return super.toDLObject().encodedLength();
   }
 }
Exemplo n.º 2
0
  int encodedLength() throws IOException {
    if (!empty) {
      ASN1Primitive primitive = obj.toASN1Primitive().toDERObject();
      int length = primitive.encodedLength();

      if (explicit) {
        return StreamUtil.calculateTagLength(tagNo)
            + StreamUtil.calculateBodyLength(length)
            + length;
      } else {
        // header length already in calculation
        length = length - 1;

        return StreamUtil.calculateTagLength(tagNo) + length;
      }
    } else {
      return StreamUtil.calculateTagLength(tagNo) + 1;
    }
  }
Exemplo n.º 3
0
 @Override
 int encodedLength() {
   return 1 + StreamUtil.calculateBodyLength(bytes.length) + bytes.length;
 }
 int encodedLength() {
   return 1 + StreamUtil.calculateBodyLength(string.length) + string.length;
 }
Exemplo n.º 5
0
  int encodedLength() throws IOException {
    int length = getBodyLength();

    return 1 + StreamUtil.calculateBodyLength(length) + length;
  }