1*3089Swyllys /* 2*3089Swyllys * CDDL HEADER START 3*3089Swyllys * 4*3089Swyllys * The contents of this file are subject to the terms of the 5*3089Swyllys * Common Development and Distribution License (the "License"). 6*3089Swyllys * You may not use this file except in compliance with the License. 7*3089Swyllys * 8*3089Swyllys * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*3089Swyllys * or http://www.opensolaris.org/os/licensing. 10*3089Swyllys * See the License for the specific language governing permissions 11*3089Swyllys * and limitations under the License. 12*3089Swyllys * 13*3089Swyllys * When distributing Covered Code, include this CDDL HEADER in each 14*3089Swyllys * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*3089Swyllys * If applicable, add the following below this CDDL HEADER, with the 16*3089Swyllys * fields enclosed by brackets "[]" replaced with your own identifying 17*3089Swyllys * information: Portions Copyright [yyyy] [name of copyright owner] 18*3089Swyllys * 19*3089Swyllys * CDDL HEADER END 20*3089Swyllys */ 21*3089Swyllys /* 22*3089Swyllys * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*3089Swyllys * Use is subject to license terms. 24*3089Swyllys */ 25*3089Swyllys 26*3089Swyllys #ifndef _RDN_PARSER_H 27*3089Swyllys #define _RDN_PARSER_H 28*3089Swyllys 29*3089Swyllys #pragma ident "%Z%%M% %I% %E% SMI" 30*3089Swyllys 31*3089Swyllys #ifdef __cplusplus 32*3089Swyllys extern "C" { 33*3089Swyllys #endif 34*3089Swyllys 35*3089Swyllys /* 36*3089Swyllys * The contents of this file are subject to the Mozilla Public 37*3089Swyllys * License Version 1.1 (the "License"); you may not use this file 38*3089Swyllys * except in compliance with the License. You may obtain a copy of 39*3089Swyllys * the License at http://www.mozilla.org/MPL/ 40*3089Swyllys * 41*3089Swyllys * Software distributed under the License is distributed on an "AS 42*3089Swyllys * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 43*3089Swyllys * implied. See the License for the specific language governing 44*3089Swyllys * rights and limitations under the License. 45*3089Swyllys * 46*3089Swyllys * The Original Code is the Netscape security libraries. 47*3089Swyllys * 48*3089Swyllys * The Initial Developer of the Original Code is Netscape 49*3089Swyllys * Communications Corporation. Portions created by Netscape are 50*3089Swyllys * Copyright (C) 1994-2000 Netscape Communications Corporation. All 51*3089Swyllys * Rights Reserved. 52*3089Swyllys * 53*3089Swyllys * Contributor(s): 54*3089Swyllys * 55*3089Swyllys * Alternatively, the contents of this file may be used under the 56*3089Swyllys * terms of the GNU General Public License Version 2 or later (the 57*3089Swyllys * "GPL"), in which case the provisions of the GPL are applicable 58*3089Swyllys * instead of those above. If you wish to allow use of your 59*3089Swyllys * version of this file only under the terms of the GPL and not to 60*3089Swyllys * allow others to use your version of this file under the MPL, 61*3089Swyllys * indicate your decision by deleting the provisions above and 62*3089Swyllys * replace them with the notice and other provisions required by 63*3089Swyllys * the GPL. If you do not delete the provisions above, a recipient 64*3089Swyllys * may use your version of this file under either the MPL or the 65*3089Swyllys * GPL. 66*3089Swyllys */ 67*3089Swyllys 68*3089Swyllys typedef enum { 69*3089Swyllys OID_AVA_COMMON_NAME = 0, 70*3089Swyllys OID_AVA_SURNAME, 71*3089Swyllys OID_AVA_GIVEN_NAME, 72*3089Swyllys OID_AVA_LOCALITY, 73*3089Swyllys OID_AVA_STATE_OR_PROVINCE, 74*3089Swyllys OID_AVA_ORGANIZATION_NAME, 75*3089Swyllys OID_AVA_ORGANIZATIONAL_UNIT_NAME, 76*3089Swyllys OID_AVA_COUNTRY_NAME, 77*3089Swyllys OID_AVA_STREET_ADDRESS, 78*3089Swyllys OID_AVA_DC, 79*3089Swyllys OID_RFC1274_UID, 80*3089Swyllys OID_PKCS9_EMAIL_ADDRESS, 81*3089Swyllys OID_RFC1274_MAIL, 82*3089Swyllys OID_UNKNOWN 83*3089Swyllys } OidAvaTag; 84*3089Swyllys 85*3089Swyllys struct NameToKind { 86*3089Swyllys const char *name; 87*3089Swyllys OidAvaTag kind; 88*3089Swyllys KMF_OID *OID; 89*3089Swyllys }; 90*3089Swyllys 91*3089Swyllys #define C_DOUBLE_QUOTE '\042' 92*3089Swyllys 93*3089Swyllys #define C_BACKSLASH '\134' 94*3089Swyllys 95*3089Swyllys #define C_EQUAL '=' 96*3089Swyllys 97*3089Swyllys #define OPTIONAL_SPACE(c) \ 98*3089Swyllys (((c) == ' ') || ((c) == '\r') || ((c) == '\n')) 99*3089Swyllys 100*3089Swyllys #define SPECIAL_CHAR(c) \ 101*3089Swyllys (((c) == ',') || ((c) == '=') || ((c) == C_DOUBLE_QUOTE) || \ 102*3089Swyllys ((c) == '\r') || ((c) == '\n') || ((c) == '+') || \ 103*3089Swyllys ((c) == '<') || ((c) == '>') || ((c) == '#') || \ 104*3089Swyllys ((c) == ';') || ((c) == C_BACKSLASH)) 105*3089Swyllys 106*3089Swyllys 107*3089Swyllys #define IS_PRINTABLE(c) \ 108*3089Swyllys ((((c) >= 'a') && ((c) <= 'z')) || \ 109*3089Swyllys (((c) >= 'A') && ((c) <= 'Z')) || \ 110*3089Swyllys (((c) >= '0') && ((c) <= '9')) || \ 111*3089Swyllys ((c) == ' ') || \ 112*3089Swyllys ((c) == '\'') || \ 113*3089Swyllys ((c) == '\050') || /* ( */ \ 114*3089Swyllys ((c) == '\051') || /* ) */ \ 115*3089Swyllys (((c) >= '+') && ((c) <= '/')) || /* + , - . / */ \ 116*3089Swyllys ((c) == ':') || \ 117*3089Swyllys ((c) == '=') || \ 118*3089Swyllys ((c) == '?')) 119*3089Swyllys 120*3089Swyllys 121*3089Swyllys KMF_RETURN ParseDistinguishedName(char *, int, KMF_X509_NAME *); 122*3089Swyllys 123*3089Swyllys #ifdef __cplusplus 124*3089Swyllys } 125*3089Swyllys #endif 126*3089Swyllys #endif /* _RDN_PARSER_H */ 127