Пример #1
0
 /**
  * Invokes the parse handler for the current path and advances to the next position in the encoded
  * bytes.
  *
  * @param tag to inspect for internal tags
  * @param encoded to parse
  */
 private void parseTag(final DERTag tag, final ByteBuffer encoded) {
   final int nextPos = readLength(encoded) + encoded.position();
   final ParseHandler handler = handlerMap.get(currentPath);
   if (handler != null) {
     encoded.limit(nextPos);
     handler.handle(this, encoded);
   }
   if (tag.isConstructed()) {
     parseTags(encoded);
   }
   encoded.position(nextPos);
   encoded.limit(encoded.capacity());
 }
Пример #2
0
 /**
  * Parse a DER-encoded data structure by calling registered handlers when points of interest are
  * encountered in the parse tree.
  *
  * @param encoded DER-encoded bytes.
  */
 public void parse(final ByteBuffer encoded) {
   currentPath = new DERPath();
   parseTags(encoded);
 }