1/*
2 * Copyright (c) 2002-2003,2011,2014 Apple Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please
7 * obtain a copy of the License at http://www.apple.com/publicsource and
8 * read it before using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
12 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
13 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
15 * Please see the License for the specific language governing rights and
16 * limitations under the License.
17 *
18 * cuOidParser.cpp - parse an Intel-style OID, with the assistance of
19 * dumpasn1.cfg.
20 *
21 * The config file is looked for in the following locations:
22 *
23 *  current working directory (.)
24 *  parent directory (..)
25 *  The directory specified by the environment variable LOCAL_BUILD_DIR
26 *
27 * OidParser will still work if the config file is not found, but OIDs
28 * will be dispayed in raw hex format.
29 */
30
31#ifndef	_OID_PARSER_H_
32#define _OID_PARSER_H_
33
34#include <Security/cssmtype.h>
35
36/*
37 * Generated strings go into a client-allocated char array of
38 * this size.
39 */
40#define OID_PARSER_STRING_SIZE	120
41
42class OidParser
43{
44private:
45	CSSM_DATA_PTR		configData;		// contents of  dumpasn1.cfg
46public:
47	/* costruct with noConfig true - skip reading config file */
48	OidParser(bool noConfig=false);
49	~OidParser();
50
51	/*
52	 * Parse an Intel-style OID, generating a C string in
53	 * caller-supplied buffer.
54	 */
55	void oidParse(
56		const unsigned char	*oidp,
57		unsigned			oidLen,
58		char 				*strBuf);
59
60};
61
62#endif	/* _OID_PARSER_H_ */
63