use of io.churchkey.asn1.DerParser in project ldaptive by vt-middleware.
the class SyncDoneControl method decode.
@Override
public void decode(final DERBuffer encoded) {
final DERParser parser = new DERParser();
parser.registerHandler(CookieHandler.PATH, new CookieHandler(this));
parser.registerHandler(RefreshDeletesHandler.PATH, new RefreshDeletesHandler(this));
parser.parse(encoded);
}
use of io.churchkey.asn1.DerParser in project ldaptive by vt-middleware.
the class EntryChangeNotificationControl method decode.
@Override
public void decode(final DERBuffer encoded) {
final DERParser parser = new DERParser();
parser.registerHandler(ChangeTypeHandler.PATH, new ChangeTypeHandler(this));
parser.registerHandler(PreviousDnHandler.PATH, new PreviousDnHandler(this));
parser.registerHandler(ChangeNumberHandler.PATH, new ChangeNumberHandler(this));
parser.parse(encoded);
}
use of io.churchkey.asn1.DerParser in project ldaptive by vt-middleware.
the class PasswordModifyResponseParser method parse.
/**
* Parse the supplied extended operation response.
*
* @param response from a password modify extended operation
*
* @return generated password
*/
public static String parse(final ExtendedResponse response) {
final StringBuilder sb = new StringBuilder();
final DERParser p = new DERParser();
p.registerHandler(GenPasswdHandler.PATH, new GenPasswdHandler(sb));
p.parse(new DefaultDERBuffer(response.getResponseValue()));
return sb.toString();
}
use of io.churchkey.asn1.DerParser in project ldaptive by vt-middleware.
the class X509DnDecoder method decode.
/**
* Converts bytes in the buffer to attribute value assertions by reading from the current position to the limit.
*
* @param encoded buffer containing DER-encoded data where the buffer is positioned at the tag of the oid and the
* limit is set beyond the last byte of attribute value data.
*
* @return decoded bytes as attribute value assertions
*/
private static List<NameValue> decode(final DERBuffer encoded) {
final List<NameValue> nameValues = new ArrayList<>();
final DERParser parser = new DERParser();
parser.registerHandler(ASSERTION_PATH, (p, e) -> {
if (UniversalDERTag.OID.getTagNo() != p.readTag(e).getTagNo()) {
throw new IllegalArgumentException("Expected OID tag");
}
final int seqLimit = e.limit();
final int oidLength = p.readLength(e);
e.limit(e.position() + oidLength);
final String oid = OidType.decode(e);
e.limit(seqLimit);
p.readTag(e);
p.readLength(e);
nameValues.add(new NameValue(oid, e.getRemainingBytes()));
});
parser.parse(encoded);
return nameValues;
}
use of io.churchkey.asn1.DerParser in project ldaptive by vt-middleware.
the class X509DnDecoder method apply.
@Override
public Dn apply(final DERBuffer encoded) {
final List<RDn> rdns = new ArrayList<>();
final DERParser parser = new DERParser();
parser.registerHandler(RDN_PATH, (p, e) -> {
rdns.add(new RDn(decode(e)));
e.position(e.limit());
});
parser.parse(encoded);
return new Dn(rdns);
}
Aggregations