public class DERParser extends Object
registerHandler(java.lang.String, org.ldaptive.asn1.ParseHandler)
methods. DERPath
strings are used to map handlers
to elements of interest.DERPath
Modifier and Type | Field and Description |
---|---|
private Map<DERPath,ParseHandler> |
handlerMap
Handlers for DER paths.
|
protected Logger |
logger
Logger for this class.
|
private Queue<DERPath> |
permutations
Permutations of the current path.
|
Constructor and Description |
---|
DERParser() |
Modifier and Type | Method and Description |
---|---|
private void |
addTag(DERTag tag,
int index)
Add the given tag at the specified index to all permutations of the current parser path and increases the number of
permutations as necessary to satisfy the following relation:
|
void |
parse(ByteBuffer encoded)
Parse a DER-encoded data structure by calling registered handlers when points of interest are encountered in the
parse tree.
|
private void |
parseTag(DERTag tag,
ByteBuffer encoded)
Invokes the parse handler for the current path and advances to the next position in the encoded bytes.
|
private void |
parseTags(ByteBuffer encoded)
Reads the supplied DER encoded bytes and invokes handlers as configured paths are encountered.
|
int |
readLength(ByteBuffer encoded)
Reads the length of a DER-encoded value from the given byte buffer.
|
DERTag |
readTag(ByteBuffer encoded)
Reads a DER tag from a single byte at the current position of the given buffer.
|
void |
registerHandler(DERPath path,
ParseHandler handler)
Registers the supplied handler to fire when the supplied path is encountered.
|
void |
registerHandler(String path,
ParseHandler handler)
|
private void |
removeTag()
Removes the tag at the leaf position of all permutations of the current parser path, and reduces the number of
permutations as necessary to satisfy the following relation:
|
protected final Logger logger
private final Map<DERPath,ParseHandler> handlerMap
public void registerHandler(String path, ParseHandler handler)
path
- to registerhandler
- to associate with the pathpublic void registerHandler(DERPath path, ParseHandler handler)
path
- to registerhandler
- to associate with the pathpublic void parse(ByteBuffer encoded)
encoded
- DER-encoded bytes.public DERTag readTag(ByteBuffer encoded)
encoded
- Buffer containing DER-encoded bytes positioned at tag.public int readLength(ByteBuffer encoded)
encoded
- buffer containing DER-encoded bytes positioned at start of length byte(s).private void parseTags(ByteBuffer encoded)
encoded
- to parseprivate void parseTag(DERTag tag, ByteBuffer encoded)
tag
- to inspect for internal tagsencoded
- to parseprivate void addTag(DERTag tag, int index)
size = 2^n
where n is the path length.
tag
- to add to path.index
- of tag relative to parent.private void removeTag()
size = 2^n
where n is the path length.
Copyright © 2003-2019 Virginia Tech. All Rights Reserved.