Re: IA5 String...

Graham Finlayson (graham@amanda.worldtalk.com)
Mon, 26 Feb 1996 10:26:26 +0000

> 
>     I await the wisdom of Steve Crocker to be visted upon us regarding
> the use of ASN.1.  I do know that, from general principle, the mere
> concept of being forced to go out and buy something like an ASN.1
> compiler just so that I can implement a parser for a format seems
> abhorrent in the extreme.  Not to mention the additional complexity,
> unwieldiness, and sluggishness it lends to the final product.
> 

There are ways to parse a BER encoded string that don't require a 
full ASN.1 compiler. See the BER parse and print routines that are 
distributed by the University of Michigan as part of the LDAP 
(Lightweight Directory Access Protocol) release. They perform both 
BER and DER "encoding/decoding" in a similar manner to printf/scanf

e.g.
/*
 * Copyright (c) 1990 Regents of the University of Michigan.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are permitted *
 provided that this notice is preserved and that due credit is given *
 to the University of Michigan at Ann Arbor. The name of the
 University * may not be used to endorse or promote products derived
 from this * software without specific prior written permission. This
 software * is provided ``as is'' without express or implied warranty.
 */

 /*
  * Parse the compare request.  It looks like this:
  *	CompareRequest := [APPLICATION 14] SEQUENCE {
  *		entry	DistinguishedName,
  *		ava	SEQUENCE {
  *			type	AttributeType,
  *			value	AttributeValue
  *		}
  *	}
  */

 if ( ber_scanf( ber, "{a{aa}}", &dn, &attr, &value ) == LBER_ERROR )
 {
    return( 0 );
 }

For more information, use the following URL

http://www.umich.edu/~rsug/ldap/


Graham
------------------------------------------------------
Graham Finlayson                 (PH)  +1 408 567 5066                       
Worldtalk Corporation            (FAX) +1 408 567 1501
Santa Clara CA 95054

Graham.Finlayson@Worldtalk.com