712f61bf4c9a9476f00529c682b55f0f0fb138ba
[shibboleth/cpp-sp.git] / xmlproviders / internal.h
1 /*
2  *  Copyright 2001-2005 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /* internal.h
18
19    Scott Cantor
20    2/14/04
21
22    $History:$
23 */
24
25 #ifndef __internal_h__
26 #define __internal_h__
27
28 #ifdef WIN32
29 # define _CRT_NONSTDC_NO_DEPRECATE 1
30 # define _CRT_SECURE_NO_DEPRECATE 1
31 #endif
32
33 // eventually we might be able to support autoconf via cygwin...
34 #if defined (_MSC_VER) || defined(__BORLANDC__)
35 # include "config_win32.h"
36 #else
37 # include "config.h"
38 #endif
39
40 #include <shib-target/shib-target.h>
41 #include <openssl/ssl.h>
42
43 #define XMLPROVIDERS_LOGCAT "XMLProviders"
44
45 #define SHIB_L(s) ::XML::Literals::s
46 #define SHIB_L_QNAME(p,s) ::XML::Literals::p##_##s
47
48 // direct OpenSSL error content to log4cpp
49 void log_openssl();
50
51 // build an OpenSSL object out of a base-64 encoded DER buffer (XML style)
52 X509_CRL* B64_to_CRL(const char* buf);
53 X509* B64_to_X509(const char* buf);
54    
55 class XML
56 {
57 public:
58         // URI constants
59     static const XMLCh SHIB_NS[];
60     static const XMLCh SHIB_SCHEMA_ID[];
61     static const XMLCh SHIBMETA_NS[];
62     static const XMLCh SHIBMETA_SCHEMA_ID[];
63     static const XMLCh CREDS_NS[];
64     static const XMLCh CREDS_SCHEMA_ID[];
65     static const XMLCh TRUST_NS[];
66     static const XMLCh TRUST_SCHEMA_ID[];
67     static const XMLCh SAML2ASSERT_NS[];
68     static const XMLCh SAML2ASSERT_SCHEMA_ID[];
69     static const XMLCh SAML2META_NS[];
70     static const XMLCh SAML2META_SCHEMA_ID[];
71     static const XMLCh XMLENC_NS[];
72     static const XMLCh XMLENC_SCHEMA_ID[];
73         
74     // ds:KeyInfo RetrievalMethods
75     static const XMLCh XMLSIG_RETMETHOD_RAWX509[];  // http://www.w3.org/2000/09/xmldsig#rawX509Certificate
76     static const XMLCh XMLSIG_RETMETHOD_RAWX509CRL[]; // http://www.w3.org/2000/09/xmldsig-more#rawX509CRL
77
78     struct Literals
79     {
80         // old metadata constants
81         static const XMLCh AttributeAuthority[];
82         static const XMLCh Contact[];
83         static const XMLCh Domain[];
84         static const XMLCh Email[];
85         static const XMLCh ErrorURL[];
86         static const XMLCh HandleService[];
87         static const XMLCh InvalidHandle[];
88         static const XMLCh Name[];
89         static const XMLCh OriginSite[];
90         static const XMLCh SiteGroup[];
91
92         static const XMLCh administrative[];
93         static const XMLCh billing[];
94         static const XMLCh other[];
95         static const XMLCh support[];
96         static const XMLCh technical[];
97
98         // credentials constants
99         static const XMLCh CAPath[];
100         static const XMLCh Certificate[];
101         static const XMLCh Class[];
102         static const XMLCh Credentials[];
103         static const XMLCh CustomResolver[];
104         static const XMLCh Key[];
105         static const XMLCh FileResolver[];
106         static const XMLCh format[];
107         static const XMLCh Id[];
108         static const XMLCh password[];
109         static const XMLCh Path[];
110         
111         // trust constants
112         static const XMLCh Exponent[];
113         static const XMLCh KeyAuthority[];
114         static const XMLCh KeyName[];
115         static const XMLCh Modulus[];
116         static const XMLCh RetrievalMethod[];
117         static const XMLCh RSAKeyValue[];
118         static const XMLCh Trust[];
119         static const XMLCh URI[];
120         static const XMLCh VerifyDepth[];
121         static const XMLCh X509CRL[];
122
123         // SAML attribute constants
124         static const XMLCh Accept[];
125         static const XMLCh Alias[];
126         static const XMLCh AnyAttribute[];
127         static const XMLCh AnySite[];
128         static const XMLCh AnyValue[];
129         static const XMLCh AttributeAcceptancePolicy[];
130         static const XMLCh AttributeRule[];
131         static const XMLCh CaseSensitive[];
132         static const XMLCh Factory[];
133         static const XMLCh Header[];
134         static const XMLCh Namespace[];
135         static const XMLCh Scope[];
136         static const XMLCh Scoped[];
137         static const XMLCh SiteRule[];
138         static const XMLCh Type[];
139         static const XMLCh Value[];
140
141         static const XMLCh literal[];
142         static const XMLCh regexp[];
143         static const XMLCh xpath[];
144
145         static const XMLCh Include[];
146         static const XMLCh Exclude[];
147         static const XMLCh url[];
148         static const XMLCh verify[];
149         
150         // new metadata constants
151         static const XMLCh AdditionalMetadataLocation[];
152         static const XMLCh AffiliateMember[];
153         static const XMLCh AffiliationDescriptor[];
154         static const XMLCh affiliationOwnerID[];
155         static const XMLCh Algorithm[];
156         static const XMLCh ArtifactResolutionService[];
157         static const XMLCh AssertionConsumerService[];
158         static const XMLCh AssertionIDRequestService[];
159         static const XMLCh AttributeAuthorityDescriptor[];
160         static const XMLCh AttributeConsumingService[];
161         static const XMLCh AttributeProfile[];
162         static const XMLCh AttributeService[];
163         static const XMLCh AuthnAuthorityDescriptor[];
164         static const XMLCh AuthnQueryService[];
165         static const XMLCh AuthnRequestsSigned[];
166         static const XMLCh AuthzService[];
167         static const XMLCh cacheDuration[];
168         static const XMLCh Company[];
169         static const XMLCh ContactPerson[];
170         static const XMLCh contactType[];
171         static const XMLCh DigestMethod[];
172         static const XMLCh EmailAddress[];
173         static const XMLCh encryption[];
174         static const XMLCh EncryptionMethod[];
175         static const XMLCh EntitiesDescriptor[];
176         static const XMLCh EntityDescriptor[];
177         static const XMLCh entityID[];
178         static const XMLCh errorURL[];
179         static const XMLCh Extensions[];
180         static const XMLCh GivenName[];
181         static const XMLCh IDPSSODescriptor[];
182         static const XMLCh index[];
183         static const XMLCh isDefault[];
184         static const XMLCh isRequired[];
185         static const XMLCh KeyDescriptor[];
186         static const XMLCh KeySize[];
187         static const XMLCh ManageNameIDService[];
188         static const XMLCh _namespace[];
189         static const XMLCh NameFormat[];
190         static const XMLCh NameIDFormat[];
191         static const XMLCh NameIDMappingService[];
192         static const XMLCh OAEParams[];
193         static const XMLCh Organization[];
194         static const XMLCh OrganizationName[];
195         static const XMLCh OrganizationDisplayName[];
196         static const XMLCh OrganizationURL[];
197         static const XMLCh PDPDescriptor[];
198         static const XMLCh protocolSupportEnumeration[];
199         static const XMLCh RequestedAttribute[];
200         static const XMLCh ResponseLocation[];
201         static const XMLCh RoleDescriptor[];
202         static const XMLCh ServiceDescription[];
203         static const XMLCh ServiceName[];
204         static const XMLCh signing[];
205         static const XMLCh SingleLogoutService[];
206         static const XMLCh SingleSignOnService[];
207         static const XMLCh SourceID[];
208         static const XMLCh SPSSODescriptor[];
209         static const XMLCh SurName[];
210         static const XMLCh TelephoneNumber[];
211         static const XMLCh use[];
212         static const XMLCh validUntil[];
213         static const XMLCh WantAuthnRequestsSigned[];
214         static const XMLCh WantAssertionsSigned[];
215
216         // access control constants
217         static const XMLCh AccessControl[];
218         static const XMLCh AND[];
219         static const XMLCh NOT[];
220         static const XMLCh OR[];
221         static const XMLCh require[];
222         static const XMLCh Rule[];
223     };
224 };
225
226 #endif